Cmd fixes

Modified PatchExecutable such that it works on windows. Added tests as well as a small fix in home_tests.
I'm surprised that this is really needed.  Isn't `\n` supposed to be interpreted by the compiler to do the right thing on the appropriate platform?  Is this really needed?