Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista Tutorial - echo output

Reply
 
Old 08-13-2007   #1 (permalink)
Jens Diekers
Guest


 
 

echo output

Hello again,

i think i have another basic question.

i will make a array like this:

$mn = 123
$x = echo $mn, ($mn)STRING...

i want that my out looks like this:
123
123STRING..., but the STRING... is interpreted as the third part of the
array. It looks like this
123
123
STRING...


What can i do?

THX

My System SpecsSystem Spec
Old 08-13-2007   #2 (permalink)
Brandon Shell
Guest


 
 

Re: echo output

$nm = 123
$x = $nm,"$nm `bSTRING"

You dont need echo and `b is a backspace. If you use "" variables are
expanded.

"Jens Diekers" <JensDiekers@discussions.microsoft.com> wrote in message
news:CEA606D9-F2FF-45ED-9533-2CD77929F0B0@microsoft.com...
> Hello again,
>
> i think i have another basic question.
>
> i will make a array like this:
>
> $mn = 123
> $x = echo $mn, ($mn)STRING...
>
> i want that my out looks like this:
> 123
> 123STRING..., but the STRING... is interpreted as the third part of the
> array. It looks like this
> 123
> 123
> STRING...
>
>
> What can i do?
>
> THX


My System SpecsSystem Spec
Old 08-13-2007   #3 (permalink)
Oisin Grehan
Guest


 
 

Re: echo output

On Aug 13, 7:34 am, Jens Diekers
<JensDiek...@discussions.microsoft.com> wrote:
> Hello again,
>
> i think i have another basic question.
>
> i will make a array like this:
>
> $mn = 123
> $x = echo $mn, ($mn)STRING...
>
> i want that my out looks like this:
> 123
> 123STRING..., but the STRING... is interpreted as the third part of the
> array. It looks like this
> 123
> 123
> STRING...
>
> What can i do?
>
> THX


Personally, I like to use this syntax for simple variable
substitution:

PS> $s = "string"
PS> "${s}test"
stringtest

Note the use of curly braces to delimit the variable name. However,
this doesn't work for grabbing an object's property:

PS> "${s.length}test"
test

Doh.

So in this case, I use a new evaluation context like so:

PS> "$($s.length)test"
6test

They're ordinary brackets this time, not the curly ones.

Hope this helps,

- Oisin

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Speaker Echo Vista General
Speaker Echo Vista hardware & devices
How to save output of echo to a file or omit using echo and save it VB Script
echo cancellation Vista General
Any Way To Get Rid Of The Echo? Vista music pictures video


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46