PowerShell by Patrik

PowerShell redirection operators

The PowerShell redirection operators are as follows, where n represents the stream number. The Success stream ( 1 ) is the default if no stream is specified.

  • > Send specified stream to a file. n>
  • >> Append specified stream to a file. n>>
  • >&1 Redirects the specified stream to the Success stream. n>&1

This example sends all Success stream data to a file called script.log.

.\script.ps1 > script.log

This example sends all streams output from a script called script.ps1 to a file called script.log

.\script.ps1 *> script.log

Source: about Redirection - PowerShell | Microsoft Docs

PowerShell

Comments

Leave a Comment

All fields are required. Your email address will not be published.