PowerShell - Start a PowerShell script from a batch file

by
Jeremy Canfield |
Updated: March 16 2020
| PowerShell articles
Let's say you have a batch file named MyBatch.bat. The batch file can execute a PowerShell script by using Powershell.exe and then the path to the PowerShell file. In this example, MyBatch.bat will execute the PowerShell script named Example.ps1 located at C:.
Powershell.exe -File C:/Example.ps1
In this example, MyBatch.bat will execute the PowerShell script named Example.ps1 located on the network drive \\server1\share.
Powershell.exe -File \\server1\share\example.ps1
Execution Policy
Some PowerShell scripts will require a certain Execution Policy. The -executionpolicy option can be used to run the script using a certain Execution Policy. In this example, the Remote Signed Execution Policy is used.
Powershell.exe -executionpolicy remotesigned -File \\server1\share\example.ps1
Did you find this article helpful?
If so, consider buying me a coffee over at