directly write to the console is the same as out-host.
write-host does a tostring() on the objects for displaying forcing the
object to string format, but can be used for collored output.
but we aware that write-host sometimes can give a other output as expected :
some samples that might help.
PS C:\Users\mvanorsouw> $a = 1,2,3
PS C:\Users\mvanorsouw> write-host $a
1 2 3
PS C:\Users\mvanorsouw> out-host $a
Out-Host : A positional parameter cannot be found that accepts argument
At line:1 char:9
+ out-host <<<< $a
PS C:\Users\mvanorsouw> out-host -InputObject $a
PS C:\Users\mvanorsouw> $a | write-host -ForegroundColor yellow
(I wonder whether I can cal the error a bug)
Greetings /\/\o\/\/ http://thePowerShellGuy.com
"how to display variable value?" <how to display variable
email@example.com> wrote in message
> Suppose I have a variable initialized like
> $abc = kapil
> then what is the difference between
> write-host $abc
> directly writing $abc on console