Alan2
Alan2

Reputation: 24572

How can I make a .bat file not exit when I run a powershell script?

I put this code into a .bat script to run a file:

  powershell -NoProfile -ExecutionPolicy Bypass .\abc.ps1"

When the script finishes the window closes and I can't see the output. How can I make the window stay open?

Upvotes: 1

Views: 2212

Answers (1)

briantist
briantist

Reputation: 47792

Depends on what you want left in the window. Do you want a command prompt? If so use:

cmd /k powershell -NoProfile -ExecutionPolicy Bypass .\abc.ps1

Do you want a powershell window?

powershell -NoExit -NoProfile -ExecutionPolicy Bypass .\abc.ps1

Upvotes: 1

Related Questions