techgeek.biz being a geek is fun

[ Home ] [ Tech Tips ] [ Getting Started ] [ Contact ] [ 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}";

 

 

Luke Keam

Luke Keam

Thank you for reading.

Any questions, comments or suggestions
Email [email protected]

Have a great day from

Luke Keam 
techgeek.biz 
 

AD


                   

        

FOLLOW US

youtubemail

AD