A small Windows batch script that launches any program without triggering its built-in "Run as administrator" request — forcing it to start with standard (non-elevated) user privileges instead of the elevated ones it asks for.
set "__COMPAT_LAYER=RUNASINVOKER"
start "" /min "%~1" %2 %3 %4 %5 %6 %7 %8 %9(plus a few lines of input validation and optional logging — see Line-by-line breakdown). No installer, no dependencies, no background service, no network access — a script you can read and audit end-to-end in under a minute. An optional right-click context-menu entry and run-logging are also included — see Usage.
- What problem does this solve?
- How it works
- Line-by-line breakdown
- What this is not
- Installation
- Usage
- Why use this?
- How Windows elevation normally works
- Limitations and edge cases
- Troubleshooting
- Security notes
- FAQ
- License
Windows programs can embed a manifest flag (requireAdministrator or highestAvailable) that forces User Account Control (UAC) to prompt for elevation every single time the program starts, regardless of whether it actually needs admin rights for what you're about to do. This is extremely common with:
- Old or poorly-packaged installers and portable tools
- Utilities that only sometimes touch protected system paths but request admin unconditionally
- Apps ported from Linux/macOS where the original build process set the flag out of caution
- Legacy software whose manifest was never revisited
The result is a UAC prompt you have to click through every time, even when you trust the app and don't want it running with elevated rights on your system. This script removes that friction for a single launch.
Windows ships with an Application Compatibility subsystem (the same one used by "Compatibility Mode" in a program's Properties dialog) that can modify how an executable behaves without touching the executable itself. One of its built-in compatibility "shims" is called RUNASINVOKER.
RUNASINVOKER tells Windows: "when this process starts, run it with the same token (the same privilege level) as the process that invoked it — ignore whatever elevation level its manifest requests."
The script sets this shim via the __COMPAT_LAYER environment variable, scoped only to the cmd session it creates, and then starts your target program inside that session. Because the variable only exists in that temporary shell, it never affects anything else on your system.
This is the full current script (admin-bypass.bat):
@echo off
setlocal
if "%~1"=="" (
echo Usage: %~nx0 "C:\Path\To\Program.exe" [arguments...]
echo.
echo Drag and drop an .exe onto this script, or pass its path as an argument.
pause
exit /b 1
)
if not exist "%~1" (
echo Error: "%~1" was not found.
pause
exit /b 1
)
set "LOG=0"
if "%LOG%"=="1" (
echo %date% %time% - Launched "%~1" %2 %3 %4 %5 %6 %7 %8 %9 >> "%~dp0admin-bypass.log"
)
set "__COMPAT_LAYER=RUNASINVOKER"
start "" /min "%~1" %2 %3 %4 %5 %6 %7 %8 %9
endlocal| Part | Meaning |
|---|---|
@echo off / setlocal |
Hides the echoed commands, and scopes any variables set below (like __COMPAT_LAYER) to this script's run only, so nothing leaks into your permanent environment. |
if "%~1"=="" (...) |
If no argument was given, prints a usage message and exits instead of silently doing nothing. %~1 strips any surrounding quotes from the first argument. |
if not exist "%~1" (...) |
Checks the given path actually exists before trying to launch it, and reports a clear error if not. |
set "LOG=0" / if "%LOG%"=="1" (...) |
Optional run logging — flip LOG to 1 to append a timestamped line (program + arguments) to admin-bypass.log next to the script. Off by default. |
set "__COMPAT_LAYER=RUNASINVOKER" |
Sets the compatibility-layer environment variable for this session only. This is the actual "bypass" — it does not persist system-wide or in the registry, and disappears once the script's setlocal scope ends. |
start "" /min "%~1" %2 %3 ... %9 |
Launches the target program minimized. The empty "" is the window-title argument start expects first (so a path with spaces in it isn't mistaken for a title). %~1 is the program path; %2-%9 forward any further arguments through to it. |
endlocal |
Closes the scoped environment, confirming __COMPAT_LAYER doesn't persist beyond this run. |
To be clear about scope, since the name "bypass" can sound more dramatic than what this does:
- ❌ It does not escalate a program to admin rights.
- ❌ It does not bypass UAC's security boundary, disable UAC, or touch any Windows security setting.
- ❌ It does not grant access to anything the current (non-elevated) user account couldn't already access.
- ❌ It cannot make an app that genuinely requires admin rights work without them — it only suppresses the request, not the underlying permission check.
- ✅ It only prevents a program's manifest-requested elevation prompt from appearing, so the program runs as a normal, standard-privilege process instead.
In short: this tool can only make a program run with fewer privileges than it asked for, never more.
- Download or clone this repo.
- Keep
admin-bypass.batanywhere convenient (e.g.,C:\Tools\admin-bypass.bat). - No setup, registration, or admin rights are needed to use the script itself.
git clone https://github.com/<your-username>/<your-repo>.gitDrag the .exe (or .bat/.cmd/.msi-wrapped tool) you want to launch directly onto admin-bypass.bat in File Explorer.
admin-bypass.bat "C:\Path\To\YourProgram.exe"Create a Windows shortcut (.lnk) whose Target field is:
C:\Windows\System32\cmd.exe /min /C "set __COMPAT_LAYER=RUNASINVOKER && start "" "C:\Path\To\YourProgram.exe""
or, more simply, point the shortcut's target at the batch file with the program path as an argument:
C:\Tools\admin-bypass.bat "C:\Path\To\YourProgram.exe"
You can then pin this shortcut to the Start Menu or Taskbar like any normal app launcher.
For the fastest workflow, you can add a right-click entry on every .exe file:
- Open
add-context-menu.regin a text editor and replaceC:\Tools\admin-bypass.batwith the actual full path to where you savedadmin-bypass.bat(keep the double backslashes\\). - Double-click
add-context-menu.regand confirm the prompt to merge it into the registry. (This only writes underHKEY_CLASSES_ROOT\exefile, which does not require admin rights to edit for the current user context in most setups — if your system does prompt for elevation, that's normal for a one-time registry edit, not something this tool itself needs going forward.) - Right-click any
.exe→ Run without Admin.
To remove the entry later, double-click remove-context-menu.reg.
admin-bypass.bat includes an optional logging switch. Open the script and change:
set "LOG=0"to
set "LOG=1"Every launch will then append a timestamped line to admin-bypass.log next to the script, recording which program (and arguments) were started — useful if you use the context-menu entry a lot and want a history of what you've run.
If you need to pass command-line arguments through to the program itself, extend the script to forward all arguments instead of just %1:
cmd /min /C "set __COMPAT_LAYER=RUNASINVOKER && start "" %*"%* expands to all arguments given to the batch file, so:
admin-bypass.bat "C:\Path\To\YourProgram.exe" --flag valuewill forward --flag value to YourProgram.exe.
- Portable apps that shouldn't need admin. Many portable tools are built with
requireAdministratorbaked in "just in case," even though normal usage never touches protected paths. - Fewer interruptions. Skip the UAC click-through for apps you already trust and intentionally want to keep de-elevated.
- Principle of least privilege. Running software with the minimum privileges it actually needs is generally good security hygiene — this tool helps enforce that for programs that over-ask.
- Scoped, per-user file/registry access. Without elevation, the app's reads/writes stay confined to locations your normal user account can already touch, rather than system-wide locations.
For context, when you double-click a program with requireAdministrator in its manifest:
- Windows reads the manifest and sees the elevation requirement.
- UAC intercepts the launch and shows the consent prompt.
- If approved, Windows creates the process with a full/elevated access token (admin group enabled).
- If declined, the process doesn't start at all.
With RUNASINVOKER applied, step 2–3 are skipped: Windows creates the process with the same token as the parent process (your normal, non-elevated session), so no prompt appears and the app runs as a standard user, just like any app with no elevation requirement at all.
- Apps that truly need admin will malfunction or fail. If a program actually writes to
C:\Program Files,HKEY_LOCAL_MACHINE, or other protected areas as part of normal operation, running it de-elevated will cause write failures, silent data loss, or crashes. Use this only on apps where the elevation request is unnecessary, not apps you depend on being elevated. - Not persistent. Every launch through this script re-applies the shim fresh; it does not permanently alter the target
.exe, its manifest, or any registry key. If you want a permanent fix, see FAQ. - Per-launch, not per-user. This doesn't change system-wide UAC behavior — only the one process you start through the script.
- Windows-only. This relies on
__COMPAT_LAYER/cmd.exe, so it has no equivalent on macOS/Linux. - Some installers detect/relaunch themselves elevated anyway. A minority of installers explicitly re-launch themselves with
ShellExecute("runas", ...)in their own code — those will still trigger a UAC prompt regardless ofRUNASINVOKER, because the request comes from inside the program itself rather than its manifest.
| Symptom | Likely cause / fix |
|---|---|
| Nothing happens when I run the script | Make sure you passed a valid path in quotes, especially if it contains spaces: admin-bypass.bat "C:\My Apps\tool.exe". |
| The target app still asks for elevation | The program may be requesting elevation from inside its own code (e.g., ShellExecute with "runas"), not via its manifest — RUNASINVOKER can't suppress that. |
| The target app opens but features that need admin don't work | Expected — see Limitations. The app is running correctly, just without elevated rights. |
| A console window flashes briefly | Normal — /min minimizes it, but on some systems a brief flash can still appear before cmd closes. This is cosmetic and harmless. |
- The script contains no network calls, no downloads, no persistence mechanism, and no registry writes. It is fully contained in one line.
- Because
__COMPAT_LAYERis set withset(notsetx), it only exists for the lifetime of that onecmd /Csession and is discarded afterward. - Review the single line of code yourself before running it — that's the whole point of keeping this tool this minimal.
Yes, without needing this script at all: right-click the .exe → Properties → Compatibility tab → check "Run this program as administrator" if you want to force elevation, or use Properties → Compatibility → Run compatibility troubleshooter / manually set the RUNASINVOKER layer via Set-ProcessMitigation/Compatibility Administrator tool if you want to force de-elevation permanently. This script is meant for quick, no-footprint, per-launch use instead of editing each app's properties.
Yes — __COMPAT_LAYER and the RUNASINVOKER shim have been part of Windows' Application Compatibility infrastructure since Windows XP/Vista and are still supported in current Windows 11 builds.
Some antivirus or EDR heuristics flag any script that touches __COMPAT_LAYER or UAC-adjacent behavior, since the same shim is occasionally abused by malware trying to avoid elevation prompts for stealth. This script's use is legitimate (reducing unnecessary prompts on trusted apps), but be aware the pattern itself can trigger generic heuristic warnings — that's worth mentioning in your repo so users aren't surprised.
MIT — do whatever you want with it, no warranty.