Just use the -file argument to PowerShell.exe in the batch file:
PowerShell.exe -file c:\MyFile.ps1
In addition, some users may have their own execution policy for something that would restrict the execution of scripts, so you can do something like:
PowerShell.exe -ExecutionPolicy Bypass -file c:\MyFile.ps1
If you want to use start to start it, you can do this, as Ansgar Vichezer noted:
start "" PowerShell.exe -ExecutionPolicy Bypass -file c:\MyFile.ps1
Some notes on using start : by default, it will launch PowerShell in a separate window and continue executing the rest of the batch file without waiting for the PowerShell window to close. If this is undesirable, you have two options. You can specify /wait , which will wait for the PowerShell window to close before continuing with the batch file, or you can use the / B option, will not open a new window, and will not execute PowerShell in the current console window.
And finally, yes, if your batch file is running in the admin context, PowerShell will also be.
source share