I have a bit confused about the different printing methods (echo) to the console. I saw that there are several ways to write output to the console, for example:
Write-Host "Hello world1" "Hello World2" Out-Host -InputObject "Hello World3"
All three methods will print to the console. The mean is something simpler and less detailed and easier to use. I also found that when you write a function like:
function GetValues() { "1" "2" }
It still returns two lines in the pipeline:
And I can still print the values:
foreach ($s in GetValues) { Write-Host "s: " $s }
I found that using only the quoted string does not always appear on user hosts and that I had to use Write-Host to get print values ββon user hosts.
Somehow I find it confusing. Is "Print something" supposed to be a Write-Host alias or what is the purpose?
powershell
Andre May 31 '12 at 10:41 2012-05-31 10:41
source share