1

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 anyone know what might cause this problem ?

1
  • 2
    please post your batch script. you probably need to use call or start /wait before each of their names. Commented Jun 14, 2011 at 19:35

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.