Created
December 18, 2025 10:58
-
-
Save tnhung2011/90b403120bf4699d49c97627cb132ecb to your computer and use it in GitHub Desktop.
I don't know if anyone has posted this. This script elevates your program without using temporary VBScript file or PowerShell.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @if (@X == @Y) @end /* | |
| @echo off | |
| setlocal enableextensions enabledelayedexpansion | |
| set rargs= | |
| for /f usebackq^ tokens^=1*^ eol^= %%a in ('%*') do set rargs=%%b | |
| cscript //nologo //e:jscript "%~f0" %1 | |
| exit /b | |
| */ | |
| WScript.CreateObject("Shell.Application").ShellExecute(WScript.Arguments(0), WScript.CreateObject("WScript.Shell").Environment("Process").Item("rargs"), "", "runas"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment