Run As Administrator (GPL)
"RunAsAdministrator.cmd" is Windows batch program that elevates a script or program to admin level. This script does the same thing as you right-clicking on a program and select "Run as administrator", except it allows you to do it from the command-line or within a batch script.
"RunAsAdministrator.cmd" takes advantage of the following batch files. They are also available on this web site. So to use "RunAsAdministrator.cmd", you'll have to download these other batch scripts, if you don't already have them.
"RunAsAdministrator.cmd" is distributed as executable source code under the GNU General Public License. Please see the license agreement elsewhere on this site. If you make changes to this batch file, please feel free to upload it back here to share it with others.
"RunAsAdministrator.cmd" "program" [ "arg 1" . . . "arg N" ]
Looks like I forgot to attach the batch script. It is now attached below.
Found a single character typo that causes this script to fail in obscure cases. I've updated the script. New version is attached below.
While fixing the single character typo bug, I saw a possible improvement to the script. So I decided to implement it. Now the script takes a new optional argument, allowing you to specify the window mode for the elevated command execution. The new version of the script is attached. And the following is the new usage page.
"RunAsAdministrator.cmd" [ /w mode ] "program" [ "arg 1" . . . "arg N" ]
The following runs the command in a hidden window:
> RunAsAdministrator.cmd /w 0 echo hello
The following runs the command in maximized window:
> RunAsAdministrator.cmd /w 3 echo hello
Made two minor enhancement. One is adding debug functionality. Two is making it more concurrent with other instances. New version is attached below.
Improved the parameter handling routine so that parameters can now contain the '&' character.
Did your message disappear? Read the Forums FAQ.
TrackBack only accepted from WebSite-X Suite web sites. Do not submit TrackBacks from other sites.
Title: Has Administrator Privilege (GPL)
Spam Control | * indicates required field
Messages, files, and images copyright by respective owners.
37 Users Online
Copyright © 1996 - 2021. All Rights Reserved.