![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Bug in escape character / variable expansion? I’d like to output a variable value enclosed by ` (backwards apostrophes). For example for variable $pshome: PS> ... `C:\Program Files\Windows PowerShell\v1.0` I type (escaping backwards apostrophes with one more): PS> "``$pshome``" The result is pretty unexpected: $pshome` Is it a bug? -- Thanks, Roman |
My System Specs![]() |
| | #2 (permalink) |
| | RE: Bug in escape character / variable expansion? This should work: >"``" + $pshome + "``" `C:\Programme\Windows PowerShell\v1.0` I'm not sure why the following does not work. The first Backtick should only escape the second one. I think somehow the $ gets escaped, too. >"``$pshome``" $pshome` -- greetings dreeschkind "Roman Kuzmin" wrote: > I’d like to output a variable value enclosed by ` (backwards apostrophes). > For example for variable $pshome: > > PS> ... > `C:\Program Files\Windows PowerShell\v1.0` > > I type (escaping backwards apostrophes with one more): > PS> "``$pshome``" > > The result is pretty unexpected: > $pshome` > > Is it a bug? > > -- > Thanks, > Roman |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Bug in escape character / variable expansion? You could also try: "``{0}``" -f $pshome "Roman Kuzmin" <RomanKuzmin@discussions.microsoft.com> wrote in message news:7B2E30AE-75E1-4058-92B4-D48B3AE79AA9@microsoft.com... > I'd like to output a variable value enclosed by ` (backwards apostrophes). > For example for variable $pshome: > > PS> ... > `C:\Program Files\Windows PowerShell\v1.0` > > I type (escaping backwards apostrophes with one more): > PS> "``$pshome``" > > The result is pretty unexpected: > $pshome` > > Is it a bug? > > -- > Thanks, > Roman |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Bug in escape character / variable expansion? This works as well: "``"+"$pshome``" In any case, that does look like a bug to me. "dreeschkind" <dreeschkind@discussions.microsoft.com> wrote in message news:65902051-601F-4B51-BE4E-579DD92358D0@microsoft.com... > This should work: > >>"``" + $pshome + "``" > `C:\Programme\Windows PowerShell\v1.0` > > > I'm not sure why the following does not work. The first Backtick should > only > escape the second one. I think somehow the $ gets escaped, too. > >>"``$pshome``" > $pshome` > > > -- > greetings > dreeschkind > > "Roman Kuzmin" wrote: > >> I'd like to output a variable value enclosed by ` (backwards >> apostrophes). >> For example for variable $pshome: >> >> PS> ... >> `C:\Program Files\Windows PowerShell\v1.0` >> >> I type (escaping backwards apostrophes with one more): >> PS> "``$pshome``" >> >> The result is pretty unexpected: >> $pshome` >> >> Is it a bug? >> >> -- >> Thanks, >> Roman |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Bug in escape character / variable expansion? it's a bug -- James W. Truher [MSFT] Windows PowerShell Program Management Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. "Roman Kuzmin" <RomanKuzmin@discussions.microsoft.com> wrote in message news:7B2E30AE-75E1-4058-92B4-D48B3AE79AA9@microsoft.com... > I'd like to output a variable value enclosed by ` (backwards apostrophes). > For example for variable $pshome: > > PS> ... > `C:\Program Files\Windows PowerShell\v1.0` > > I type (escaping backwards apostrophes with one more): > PS> "``$pshome``" > > The result is pretty unexpected: > $pshome` > > Is it a bug? > > -- > Thanks, > Roman |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Re: exchange shell escape character | PowerShell | |||
| Escape character question | PowerShell | |||
| How can I escape a slash character in item name? | PowerShell | |||
| How do I escape the wildcard character in a path string? | PowerShell | |||
| howto? escape the comment character | PowerShell | |||