I was dealing with converting a batch to PoSh and had to create some wired mixture of double and single quotes. I was searching the net and got to this page http://www.vistax64.com/powershell/23546-mix-single-double-quotes.html where he used the following notation:
#
so it hit me:
instead of odd things like
write-host '$X'"Y"'$X'
I can do:
$DQ = '"'
$SQ = "'"
and then
write-host '$X$SQ$DQY$DQ$SQ$X'
I guess there might clearer strings to read but at least it works.
maybe
$_DQ_ = '"'
$_SQ_ = "'"
write-host '$X$_SQ_$_DQ_Y$_DQ_$_SQ_$X'
Sunday, December 06, 2009
single and double quotes in PowerShell (PoSh)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment