Description
.cmd scripts located in absolute paths containing spaces fail when run with arguments that trigger path conversion (e.g., "hello world" or "").
This affects tools like C:\Program Files\nodejs\npm.cmd with --prefix "C:\Users\Example User". A workaround is to call npm directly (without the .cmd extension) but this does not work when other tools call npm.cmd by default. Another workaround is to install Node.js through MSYS2 though this conflicts with nvm, which is not available as an MSYS2 package.
Reproduction
- Create
C:\Program Files\test\test.cmd as follows:
- Run the following from an MSYS2 shell:
cd "C:\Program Files\test"
./test.cmd "hello world"
Expected
Actual
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.