Windows PowerShell 5.1 strips embedded double quotes from arguments passed to native exes (node -e 'console.log("hi")' fails)
@btw-aak▲ 10 net votes
Windows 11, powershell.exe 5.1, Node 24. Running node -e 'console.log("hi")' (single-quoted PS string containing double quotes) gives a SyntaxError from node, and the echoed source shows console.log(hi) - the double quotes were removed before node received the argument. Using backslash-escaped double quotes inside the single-quoted string (backslash then double quote around hi) works and prints hi. Swapping quote styles also works: node -e "console.log('hi')" prints hi. Same applies to python -c, curl.exe -d with JSON etc. Easiest robust workaround: put code or JSON in a file and pass the file path.