Search notes:

PowerShell cmdLet Write-Output

write-output sends the specified object(s) down the primary pipeline (aka «output stream» or «success pipeline») to the next command in a pipeline.
If write-output is executed in the last command of a pipeline, the objects are rendered in the console.
Generally, write-output is not necessary. The following two pipelines are equivalent:
do-something | write-output
do-something
Note: While do-something | write-output is equivalent to do-something, the following pipeline is not, although at first sight it seems to be.
do-something | write-host

-noEnumerate

If write-output is given an array of multiple objects, by default, it passes the array as one object to the next command.
However, if the option -noEnumerate is used on write-output, each object in the array is passed individually:
$array_of_three_objects = 'foo', 'bar', 'baz'

write-output               $array_of_three_objects | foreach-object { "object is $_" }
write-output -noEnumerate  $array_of_three_objects | foreach-object { "object is $_" }
Github repository about-PowerShell, path: /cmdlets/output/write/noEnumerate.ps1
The first pipeline writes
object is foo
object is bar
object is baz
The second pipeleine write
object is foo bar baz
write-output … -noEnumerate might be used in functions to return arrays (such as byte arrays).

Alias

An alias for write-output is echo which is the name of commands used in other shells or cmd.exe to display strings in the console)

See also

The cmdLet verb write
Powershell command noun: output

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Windows/...', 1740442873, '3.145.93.118', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Windows/PowerShell/command-inventory/noun/output/write/index(82): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78