Heather
Heather

Reputation: 173

Get bat file to contiune when lauching PowerShell

I have a bat file that is launching a powerShell script. I would like for the bat file to keep moving after it launches the script and not wait for the powerShell script to complete. Every time right now when i launch the powerShell script the bat files waits till the powerShell script finishes before it moves on. Here is how I'm calling my powerShell script:

PowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command "&'C:\Users\sharph\Desktop\test.ps1'"

Upvotes: 2

Views: 73

Answers (1)

Bloodied
Bloodied

Reputation: 975

SS64 'start' help page

You'll want to start it with the start command, like this;

start "" "PowerShell"

This will start a program without waiting for it to close, although that behavior can be re-added with the /w or /wait option. The blank "" is in place of the title, not always needed but generally a safe thing to add.


Perhaps this will work?

start "" "PowerShell" -NoProfile -ExecutionPolicy Bypass -Command "^& 'C:\Users\sharph\Desktop\test.ps1'"

of course, the & had to be delimited to ^&.

Upvotes: 3

Related Questions