just cache the script on windows
Fixed a couple logic errors
Merge pull request #4609 from UtahDave/fix_cmd.script_windows

Fix cmd.script on Windows.