Cmd fixes

Modified PatchExecutable such that it works on windows. Added tests as well as a small fix in home_tests.
Also curious that the code above adds a space before the `\r\n` but the test doesn't check it.  Why?