improve build script to detect calling pwd -W on Windows