[ 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}";

 

Luke Keam
Thank you for reading. Any questions, comments or suggestions email me [email protected]
Have a great day

Luke Keam
techgeek.biz

AD

techgeek logo.biz

AD