开发者

Problem executing multiple powershell scripts from a batch file

I have a .bat that calls 3 PowerShell scripts Basically the bat file looks like this

PScript1
Pscript2
Pscript3

After the Pscript1 the batch file does not execute Pscript2 or Pscript3, it stops and does not seem to return control to the batch file. Does anyon开发者_JAVA百科e know what might cause this problem ?


In a batch file you would typically use && or || depending on whether or not you wanted the subsequent commands to run based on the success of previous commands e.g.:

powershell.exe .\PScript1.ps1 && powershell.exe .\PScript2.ps1

This invocation would execute the following command only if the preceeding command succeeded. You also need to specify powershell.exe as the EXE. The default action for a .ps1 is to open the file for editing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜