![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | 1..9|%{write-host $_:443} I haven't found a way to properly escape the ':' character in the following 1..9|%{write-host 10.0.0.$_:443} 1..9|%{write-host 10.0.0.$_} works just fine but even 1..9|%{write-host 10.0.0.$_some arbitrary text} doesn't anyone have a clue to give me? |
My System Specs![]() |
| | #2 (permalink) |
| Guest | RE: 1..9|%{write-host $_:443} try 1..9 | %{write-host 10.0.0.`:433} "Æ" wrote: > I haven't found a way to properly escape the ':' character in the following > > 1..9|%{write-host 10.0.0.$_:443} > > 1..9|%{write-host 10.0.0.$_} works just fine but even > > 1..9|%{write-host 10.0.0.$_some arbitrary text} doesn't > > anyone have a clue to give me? > > > |
My System Specs![]() |
| | #3 (permalink) |
| Guest | RE: 1..9|%{write-host $_:443} Sorry, I misread what you wanted. This will include $_ value: 1..9 | %{write-host ("10.0.0." + $_ + ":433")} "Æ" wrote: > I haven't found a way to properly escape the ':' character in the following > > 1..9|%{write-host 10.0.0.$_:443} > > 1..9|%{write-host 10.0.0.$_} works just fine but even > > 1..9|%{write-host 10.0.0.$_some arbitrary text} doesn't > > anyone have a clue to give me? > > > |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: 1..9|%{write-host $_:443} 1..9|%{write-host "10.0.0.$($_):443"} <Æ> wrote in message news:%23qba14uyHHA.1208@TK2MSFTNGP03.phx.gbl... >I haven't found a way to properly escape the ':' character in the following > > 1..9|%{write-host 10.0.0.$_:443} > > 1..9|%{write-host 10.0.0.$_} works just fine but even > > 1..9|%{write-host 10.0.0.$_some arbitrary text} doesn't > > anyone have a clue to give me? > > |
My System Specs![]() |
| | #5 (permalink) |
| Guest | Re: 1..9|%{write-host $_:443} This works: 1..9 | % { Write-Host $("10.0.0.$_"+":443") } Funny, you would think that the parser would break out of "variable name" with the standard backtick escape character...hmmm. -- (^_^)v ~Clint My (very) humble blogger beginnings: http://outputredirection.blogspot.com <Æ> wrote in message news:%23qba14uyHHA.1208@TK2MSFTNGP03.phx.gbl... >I haven't found a way to properly escape the ':' character in the following > > 1..9|%{write-host 10.0.0.$_:443} > > 1..9|%{write-host 10.0.0.$_} works just fine but even > > 1..9|%{write-host 10.0.0.$_some arbitrary text} doesn't > > anyone have a clue to give me? > > |
My System Specs![]() |
| | #6 (permalink) |
| Guest | Re: 1..9|%{write-host $_:443} You can also use a blank space followed by the backspace escape character (`b) after $_ 1..9|%{write-host 10.0.0.$_ `b:443} 1..9|%{write-host 10.0.0.$_ `bsome arbitrary text} -- Kiron |
My System Specs![]() |
| | #7 (permalink) |
| Guest | Re: 1..9|%{write-host $_:443} Or: 1..9|%{write-host 10.0.0.${_}:443} Using the delimited variable syntax where the variable name is enclosed in braces. or just quote the colon: 1..9|%{write-host 10.0.0.$_`:443} -bruce -- Bruce Payette [MSFT] Windows PowerShell Technical Lead Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. "Brandon Shell" <tshell.mask@mk.gmail.com> wrote in message news:%23qaltCvyHHA.5408@TK2MSFTNGP02.phx.gbl... > 1..9|%{write-host "10.0.0.$($_):443"} > > <Æ> wrote in message news:%23qba14uyHHA.1208@TK2MSFTNGP03.phx.gbl... >>I haven't found a way to properly escape the ':' character in the >>following >> >> 1..9|%{write-host 10.0.0.$_:443} >> >> 1..9|%{write-host 10.0.0.$_} works just fine but even >> >> 1..9|%{write-host 10.0.0.$_some arbitrary text} doesn't >> >> anyone have a clue to give me? >> >> > |
My System Specs![]() |
| | #8 (permalink) |
| Guest | Re: 1..9|%{write-host $_:443} That doesn't work for me. 10.0.0.:433 10.0.0.:433 10.0.0.:433 10.0.0.:433 10.0.0.:433 10.0.0.:433 10.0.0.:433 10.0.0.:433 10.0.0.:433 "Jeremiah Buckley" > try 1..9 | %{write-host 10.0.0.`:433} |
My System Specs![]() |
| | #9 (permalink) |
| Guest | Re: 1..9|%{write-host $_:443} Quoting the colon is what I tried first. 10.0.0.:433 10.0.0.:433 10.0.0.:433 10.0.0.:433 10.0.0.:433 10.0.0.:433 10.0.0.:433 10.0.0.:433 10.0.0.:433 That result surprised me. "Bruce Payette [MSFT]" > or just quote the colon: > > 1..9|%{write-host 10.0.0.$_`:443} |
My System Specs![]() |
| | #10 (permalink) |
| Guest | RE: 1..9|%{write-host $_:443} Although this isn't as quick as some of the other suggestions, I've been using this syntax more and more recently when scripting just because I find it a bit easier to to read (since variables and formatting info can be addressed separately): 1..9 | %{write-host ("10.0.0.{0}:443" -f $_)} -Hecks "Æ" wrote: > I haven't found a way to properly escape the ':' character in the following > > 1..9|%{write-host 10.0.0.$_:443} > > 1..9|%{write-host 10.0.0.$_} works just fine but even > > 1..9|%{write-host 10.0.0.$_some arbitrary text} doesn't > > anyone have a clue to give me? > > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| When to use write-host? | how to display variable value? | PowerShell | 1 | 08-20-2008 03:27 PM |
| redirect write-host | DouglasWoods | PowerShell | 12 | 04-26-2007 05:10 PM |
| Non ASCII characters with write-host | Peter Monadjemi | PowerShell | 6 | 02-05-2007 02:02 PM |
| write host color function | IT Staff | PowerShell | 1 | 01-23-2007 01:46 AM |
| Write-Host question | Doug | PowerShell | 2 | 12-20-2006 12:48 PM |