![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | Re: exchange shell escape character Just a bump and addition of the powershell group to see if anybody knows about this "Bob Butler" <noway@xxxxxx> wrote in message news:eABSl0DDIHA.5024@xxxxxx Quote: > I've just started playing with the exchange shell for Exchange 2007 and > ran into something odd. In straight Powershell I can write a line like > $t = "line1`r`nline2" > and it will create a string with a CR/LF sequence in the middle. In the > Exchange Management Shell, which I thought was essentially Powershell, > that doesn't work. The backtick character no longer acts as an esacpe > sequence for special characters and I haven't been able to find any > mention of this change anywhere. > > Does anybody know if there is an alternative besides defining characters > using ([char]x)? > |
My System Specs![]() |
| | #2 (permalink) |
| | Re: exchange shell escape character Hi I launched Exchange Management Shell and ran PS > $t = "line1`r`nline2" PS > $t line1 line2 In "straight Powershell" the output is the same. PS > $t = "line1`r`nline2" PS > $t line1 line2 What happens when you run PS C:\Scripts> "`$pwd=$pwd" $pwd=C:\Scripts Do you get the same ($pwd=your working directory path)? Shay http://scriptolog.blogspot.com Quote: > Just a bump and addition of the powershell group to see if anybody > knows about this > > "Bob Butler" <noway@xxxxxx> wrote in message > news:eABSl0DDIHA.5024@xxxxxx > Quote: >> I've just started playing with the exchange shell for Exchange 2007 >> and >> ran into something odd. In straight Powershell I can write a line >> like >> $t = "line1`r`nline2" >> and it will create a string with a CR/LF sequence in the middle. In >> the >> Exchange Management Shell, which I thought was essentially >> Powershell, >> that doesn't work. The backtick character no longer acts as an >> esacpe >> sequence for special characters and I haven't been able to find any >> mention of this change anywhere. >> Does anybody know if there is an alternative besides defining >> characters using ([char]x)? >> |
My System Specs![]() |
| | #3 (permalink) |
| | Re: exchange shell escape character Quote: Quote: >> and it will create a string with a CR/LF sequence in the middle. In >> the Exchange Management Shell, which I thought was essentially >> Powershell, that doesn't work. The backtick character no longer acts >> as an esacpe sequence for special characters and I haven't been able >> to find any mention of this change anywhere. [PS] >$t = "line1`r`nline2" [PS] >$t line1 line2 You're not seeing the same? Well, the Exchange shell is PowerShell, but with a few addons. Here's what starts the Exchange shell: C:\WINDOWS\system32\WindowsPowerShell\v1.0\PowerShell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -noexit -command ". 'C:\Program Files\Microsoft\Exchange Server\bin\Exchange.ps1'" Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
My System Specs![]() |
| | #4 (permalink) |
| | Re: exchange shell escape character "Shay Levi" <no@xxxxxx> wrote in message news:8766a94496d98c9db1711d7aec6@xxxxxx Quote: > > Hi > > I launched Exchange Management Shell and ran > PS > $t = "line1`r`nline2" > PS > $t > line1 > line2 insert special characters in a string literal no matter what I did. Today it is working perfectly. Thanks for trying it. If I can figure out what causes it to get screwed up I'll post back. Until then..... nevermind <g> |
My System Specs![]() |
| | #5 (permalink) |
| | Re: exchange shell escape character "Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote in message news:uq78EBPDIHA.2004@xxxxxx Quote: > Quote: Quote: >>> and it will create a string with a CR/LF sequence in the middle. In the >>> Exchange Management Shell, which I thought was essentially Powershell, >>> that doesn't work. The backtick character no longer acts as an esacpe >>> sequence for special characters and I haven't been able to find any >>> mention of this change anywhere. > This is from the Exchange 2007 shell in my VM: > > [PS] >$t = "line1`r`nline2" > [PS] >$t > line1 > line2 > > You're not seeing the same? [PS] >$t line1`r`nline2 today it is working; same system, same everything, no reboot,... I'll have to try to figure out what I did yesterday that confused it |
My System Specs![]() |
| | #6 (permalink) |
| | Re: exchange shell escape character Any other PS Snapins included or "Dot Sourced" Scripts in your EMS profile? Something that can break/override PowerShell defaults??? Shay http://scriptolog.blogspot.com Quote: > "Shay Levi" <no@xxxxxx> wrote in message > news:8766a94496d98c9db1711d7aec6@xxxxxx > Quote: >> Hi >> >> I launched Exchange Management Shell and ran >> PS > $t = "line1`r`nline2" >> PS > $t >> line1 >> line2 > backtick to insert special characters in a string literal no matter > what I did. > > Today it is working perfectly. > > Thanks for trying it. If I can figure out what causes it to get > screwed up I'll post back. Until then..... nevermind <g> > |
My System Specs![]() |
| | #7 (permalink) |
| | Re: exchange shell escape character Did you by any chance typed 'line1`r`nline2' (with a single quote)? The single quotation sign is designed to "turn off" subexpansion. Shay http://scriptolog.blogspot.com Quote: > "Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote in message > news:uq78EBPDIHA.2004@xxxxxx > Quote: Quote: >>>> and it will create a string with a CR/LF sequence in the middle. >>>> In the Exchange Management Shell, which I thought was essentially >>>> Powershell, that doesn't work. The backtick character no longer >>>> acts as an esacpe sequence for special characters and I haven't >>>> been able to find any mention of this change anywhere. >>>> >> >> [PS] >$t = "line1`r`nline2" >> [PS] >$t >> line1 >> line2 >> You're not seeing the same? >> > [PS] >$t > line1`r`nline2 > today it is working; same system, same everything, no reboot,... I'll > have to try to figure out what I did yesterday that confused it > |
My System Specs![]() |
| | #8 (permalink) |
| | Re: exchange shell escape character "Shay Levi" <no@xxxxxx> wrote in message news:8766a94496eb8c9db1aeaf551a6@xxxxxx Quote: > Any other PS Snapins included or "Dot Sourced" Scripts in your EMS > profile? > Something that can break/override PowerShell defaults??? that exact script from the exchange shell and it failed miserably. Several things blew up but all were related to the escape sequence. Things like: $ncmd="this is some text`r`n" $ncmd+="and this is more`r`n" resulted in a syntax error that made no sense. A test parsing routine that had $lines=$request.Split("`n") resulted in an array of lines broken on "n" rather than "`n" The exact same .ps1 file ran fine under powershell and required extensive reworking under the exchange shell. Today it's running fine under both. Something got hosed somewhere and if I can duplicate it again I'll try to track down the problem. I had started and stopped the exchange shell, logged on and off and rebooted in between tests and it was very consistently not working. Maybe it just doesn't like Thursdays! <g> |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| 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 | |||
| Bug in escape character / variable expansion? | PowerShell | |||