Double Quotes embedded in Double Quotes

Microsoft Windows
Post Reply
Gregor Y
Posts: 3
Joined: 2022-Jul-20, 5:40 pm

Double Quotes embedded in Double Quotes

Post by Gregor Y »

Hi there,

Can you please add the following example on how to embed double quotes to the "Using "Double Quotes"" section of the Escape Characters page.

Code: Select all

powershell.exe -command "&{$m = "\""hello world"\"";write-host $m}"
Thanks!

this is also helpful with commands like

Code: Select all

sqlplus user/\""password with spaces"\"@service
User avatar
Simon Sheppard
Posts: 190
Joined: 2021-Jul-10, 7:46 pm
Contact:

Re: Double Quotes embedded in Double Quotes

Post by Simon Sheppard »

OK that's done, I also added a couple of alternatives :)
Gregor Y
Posts: 3
Joined: 2022-Jul-20, 5:40 pm

Re: Double Quotes embedded in Double Quotes

Post by Gregor Y »

thanks, I also noticed this version works as well

Code: Select all

powershell.exe -command "&{$m = \"hello world\";write-host $m}"
Gregor Y
Posts: 3
Joined: 2022-Jul-20, 5:40 pm

Re: Double Quotes embedded in Double Quotes

Post by Gregor Y »

that in turn leads to this one working in Windows-PowerShell v5.1(non ISE)

Code: Select all

PS C:\Working\Path> powershell.exe -command '$m=\"hello world\";write-host $m'
which I would not have expected
Post Reply