[ Home ] [ Tech Tips ] [ Raspberry Pi ] [ Powershell ] [ Ubuntu ] [ Django ] [ About ]
PowerShell | Start PowerShell Script via Run.bat

PowerShell | Start PowerShell Script via Run.bat batch Script

An easy way to start up a PowerShell script is with a .bat file, Lets fire up the sHeLl! and get cracking! This is a quick one.    

Below is the basic script if you want to copy it into a file and save it as say "run.bat"

@ECHO OFF
SET ThisScriptsDirectory=%~dp0
SET PowerShellScriptPath="%ThisScriptsDirectory%Main.ps1"
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""%PowerShellScriptPath%""' -Verb RunAs}";

 

Also can find it here on GitHub as well as a video below

https://github.com/LukeKeam/powershell-start-script-bat

 


Luke Keam
Thank you for reading. Any questions, comments or suggestions email me [email protected]
Luke Keam
techgeek.biz

FOLLOW US

Name
Email:

AD