Skip to content

Quoting on Windows with PowerShell? #1743

Answered by r-darwish
lf- asked this question in Q&A
Discussion options

You must be logged in to vote

Apparently, escaping the quotes with \ seems to do the trick in both Powershell 5 and 7. Cmd seems to be the oddest one as it converts the double quotes into single quotes

Powershell has some complex argument conversion magic because it tries to achieve a delicate balance between being a language with actual types but still be useful as a shell language without forcing you to quote every string or escape any hyphen between numbers so it won't be considered as the minus operator. I'm not sure what's CMD's excuse, though.

What I don't understand is why the \ did the trick and not `, which is the actual escape character in powershell, but I'm sure someone in StackOverflow will be happy to p…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@wistlo
Comment options

@BillHally
Comment options

Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants