Possible duplicates:What is the PowerShell equivalent for Bash && & && and || operators?Can I get && to work in Powershell?
In bash, I use ./task1.sh && ./task2.shtask1 to run, and then run task2 until task1 returns an error code. When I try .\task1.bat && .\task2.batin Powershell, I get the error message "Token && is not a valid delimiter in this version."
./task1.sh && ./task2.sh
.\task1.bat && .\task2.bat
Is there an equivalent for && in Windows Powershell?
This is the closest I can get:
.\task1.ps1 ; if($?){.\task2.ps1}
I think the closest equivalent is:
.\task1.bat;if($lastexitcode -eq 0){.\task2.bat}
, Powershell -and, , .
-and