Created
September 8, 2012 07:55
-
-
Save hanji/3672652 to your computer and use it in GitHub Desktop.
WSH script to launch application with elevated privileges
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
| (function(){ | |
| if (WScript.Arguments.Length !== 0){ | |
| var app = WScript.Arguments(0); | |
| } else { | |
| WScript.Echo('sudo <application> [<parameters>]'); | |
| WScript.Quit(1); | |
| } | |
| var sh = new ActiveXObject('Shell.Application'); | |
| var args = []; | |
| for (i = 1; i < WScript.Arguments.Length; ++i){ args.push('"' + WScript.Arguments(i) + '"') } | |
| args = args.join(' '); | |
| sh.ShellExecute(app, args, '', 'runas'); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment