r/PowerShell • • Mar 04 '20

New PowerShell Version - v7.0.0

https://github.com/PowerShell/PowerShell/releases/tag/v7.0.0
160 Upvotes

70 comments sorted by

View all comments

Show parent comments

3

u/Beirbones Mar 04 '20

What's the chain operator do?

5

u/halbaradkenafin Mar 04 '20

Run the second command only if the first succeeds. I use it a lot in the command line for git commit && git push and similar

2

u/rjmholt Mar 04 '20

There are two of them in fact, the other is ||.

|| will run the second command if the first fails:

icacls .\ex.txt /setowner doesntexist || Write-Error "Did not set file owner"