Refacter command shell differences between Windows/Linux, and check exit status of process on Windows