More changes to finally make the script work on Windows.