Simple batch file to run a directory of powershell .ps1 files

A few times our support team has given me a zip file full of .ps1 files they want me to run – today I got two zip files with about 20 powershell scripts.

Not wanting to write them by hand, I wrote this small batch file called run.bat and put it in the directory with the ps1 files.

powershell -Command "& {Set-ExecutionPolicy bypass}" -NoExit
for %%f in (*.ps1) do powershell -Command "& {.\%%f}" -NoExit
pause

Leave a Reply