in reply to substitute \ and / with \\ ?

The only thing wrong with yours is that it needs a /g on the end of the substitution. But it might be more readable to write:
s![/\\]!\\\\!g;