Pipeline Chain Operator

noun

say it: “PYP-lyn CHAYN OP-uh-ray-ter” /ˈpaɪpˌlaɪn ˈtʃeɪn ˈɑpəˌreɪtər/

A symbol placed between two commands so that the second one runs only if the first one worked, or only if it failed.

What is a pipeline chain operator?

A pipeline chain operator makes the next command depend on how the last one went. &&, read "and then", runs it only when the first worked; ||, read "or else", only when it failed. They're new in PowerShell 7; Windows PowerShell 5.1 doesn't have them.

Copy-Item edited -Destination backup -Recurse -Force && Write-Output 'Backup done'

In a sentence

  • “With a pipeline chain operator, Backup done printed only when the copy worked.”
  • “Sam used the pipeline chain operator || to print a warning when the folder name was wrong.”

Level: Apprentice · More PowerShell terms at this level

Updated