powershell - Write-Host - Lose new line formating -


 $output=$(dir)  write-host $output 

the output have is:

jboss-eap-5.1 jboss-eap-6.1 jboss-eap-6.1(2) middleware oracle testsymlinksjboss tomcata tomcatb was7.0 

is there way have normal output this: echo $output

directory: c:\servers   mode                lastwritetime     length name ----                -------------     ------ ---- d----         9/18/2012  10:33            jboss-eap-5.1 d----          5/9/2013   1:10 pm            jboss-eap-6.1 d----         8/22/2013  11:33            jboss-eap-6.1(2) d----         1/22/2013   2:29 pm            middleware d----         1/22/2013   2:25 pm            oracle d----          8/1/2013   2:43 pm            testsymlinksjboss d----          4/4/2013   4:25 pm            tomcata d----         7/22/2013   4:49 pm            tomcatb d----        10/18/2012   3:00 pm            was7.0 

i use write-host inside function (so don't want use echo ) reply

write-host host no formatting. displays strings (or objects coercing them string) provide. try powershell formatting you:

write-host ($output | out-string) 

Comments

Popular posts from this blog

c++ - Linked List error when inserting for the last time -

java - activate/deactivate sonar maven plugin by profile? -

java - What is the difference between String. and String.this. ? -