Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

&& Equivalent in Powershell [duplicate]

In bash I use ./task1.sh && ./task2.sh to run task1, and then run task2 as long as task1 did not return an error code. When I try .\task1.bat && .\task2.bat in Powershell I get the error "The Token && Is not a valid separator in this version."

Is there an equivalent for && in Windows Powershell?

like image 446
Ryan Avatar asked Jun 10 '11 20:06

Ryan


1 Answers

This is the closest I can get:

  .\task1.ps1 ; if($?){.\task2.ps1}
like image 174
mjolinor Avatar answered Oct 08 '22 16:10

mjolinor