Does this ever work on windows? I'd think it wouldn't be necessary if running under cygwin, and if not running under cygwin, then it wouldn't work due to bash not being available.

Unless it works when not running under cygwin, but bash is present on the user's PATH?

Please add a comment about when this works, or if it doesn't, then delete it.