0

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.

3
  • sounds like you need the stop parsing character (--%). Try npm start --% "A B.txt" Commented Aug 24, 2023 at 19:38
  • How do you run it in Powershell? Commented Aug 24, 2023 at 20:48
  • --% does not seem to work. I run npm start "A B.txt" Commented Aug 24, 2023 at 21:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.