Chain commands on the PowerShell command line (like POSIX sh &&) [duplicate] Chain commands on the PowerShell command line (like POSIX sh &&) [duplicate] powershell powershell

Chain commands on the PowerShell command line (like POSIX sh &&) [duplicate]


Try this:

$errorActionPreference='Stop'; cmd1; cmd2


There is no direct analog to && or ||. There are several discussions on alternatives though. Here is one example:

conditional execution (&& and ||) in powershell