Alka, that has to be the most inefficient way to do that...Executing a command like that every prethink?
Execute the command once, then alter the pev_weapons bitmask to be ONLY the knife, which would be something like set_pev(id,pev_weapons,CSW_KNIFE);
To safeguard from some workarounds (I think lastinv might be one of them), also hook CurWeapon and test which weapon it is being changed to - if it's not the knife, execute weapon_knife again.