I am trying to pass a file name that has a space to npm script. For example, if the file name is “A B.text”, when I try to run the following command npm start "A B.txt"
in Powershell, somehow the argument becomes ^A^ B.txt^
when I check the argument in the process object. If I add write file name directly in package.json in the following format instead of passing it from Powershell, I get the expected name in the argument array.
...
"start": "node ./dist/main.js \"A B.txt\""
...
I have tried using escape character (`) but it does not seem to work.
sounds like you need the stop parsing character (
--%
). Trynpm start --% "A B.txt"