Start a PowerShell Script from a .bat File (With Elevation)
Why A .bat Launcher
PowerShell scripts have no file association by default — double-clicking a .ps1 opens it in Notepad. They also do not self-elevate, so a script that needs administrator rights just fails on the first privileged call.
A small .bat file solves both: double-click to run, and request elevation in the process. It is the pragmatic way to ship a PowerShell tool to someone who is not going to open a console.

The Launcher
@ECHO OFF
SET ThisScriptsDirectory=%~dp0
SET PowerShellScriptPath=%ThisScriptsDirectory%Main.ps1
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "Start-Process PowerShell -Verb RunAs -ArgumentList '-NoProfile','-ExecutionPolicy','Bypass','-File','"%PowerShellScriptPath%"'"
Save as run.bat next to your script. Double-click and you get a UAC prompt, then your script runs in an elevated window.
Also on GitHub: github.com/LukeKeam/powershell-start-script-bat.
What Each Part Is Doing
%~dp0 is the batch file's own directory, including the trailing backslash. It is the reason the launcher works when the folder is moved, renamed or on a network share — a hardcoded path would not.
-NoProfile skips the user's PowerShell profile. Without it, a profile that prints output or sets a location changes your script's behaviour in ways that are hard to diagnose. Always use it in a launcher.
-Verb RunAs is what triggers the UAC prompt. It must be on Start-Process, not on the outer PowerShell — the outer process runs unelevated and asks Windows to launch an elevated child.
-ArgumentList as separate quoted strings avoids the quoting puzzle that eats most of the time with this pattern. Building one long argument string and nesting quotes inside it is where these launchers usually break.
The Version Without Elevation
If the script does not need admin, do not ask for it — an unnecessary UAC prompt is a reason for someone to click "no":
@ECHO OFF
PowerShell -NoProfile -ExecutionPolicy Bypass -File "%~dp0Main.ps1"
PAUSE
PAUSE keeps the window open so the user can read the output before it vanishes. Only add it for interactive use; it will hang a scripted run.
Keeping The Window Readable
An elevated child process closes when it finishes, taking any output with it. Two ways to keep it:
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "Start-Process PowerShell -Verb RunAs -ArgumentList '-NoProfile','-ExecutionPolicy','Bypass','-NoExit','-File','"%~dp0Main.ps1"'"
-NoExit keeps the elevated console open after the script ends. Useful while developing; annoying in production.
Or have the script write a log and tell the user where it is. For anything that runs unattended, the log is the better answer.

Traps Worth Knowing
Paths with spaces. C:\Program Files\... breaks a launcher that forgets quotes. The %~dp0 form above quotes the whole path; if you build paths by concatenation instead, wrap them.
Working directory. An elevated process starts in C:\Windows\System32, not the script's folder. If your script uses relative paths, derive them from $PSScriptRoot inside the script rather than relying on where it was launched from.
\ doubling in batch. Batch has no escape sequences, so %~dp0 returns a path already ending in a backslash. Writing %~dp0\Main.ps1 produces a double backslash, which usually works but occasionally does not. Use %~dp0Main.ps1 or %~dp0 with the filename appended without an extra separator.
Antivirus and SmartScreen. A .bat that launches an elevated PowerShell with -ExecutionPolicy Bypass is a pattern that security software legitimately flags, because it matches how malware persists. Expect a warning on first run, and consider signing the script if you distribute it.
-ExecutionPolicy Bypass in the launcher does not unblock a downloaded script. If your .ps1 came from the internet, Unblock-File is still required. That distinction is the single most common reason this pattern "does not work" on someone else's machine.

When Not To Use This
If the script runs on a schedule, use a scheduled task — that is what it is for, and it survives reboots without a logged-in session.
If the script is for you only, a PowerShell profile function or a pwsh shortcut with the command set is less machinery.
The .bat launcher earns its place when a human double-clicks it. For everything else there is a more appropriate mechanism.
Don't trust the download button. Trust the hash.
If this was useful, More hands-on tech guides at TechGeek. No pressure — read it whenever it's useful.