Request Elevation inside CMD/batch file
Is it possible to request elevation inside a CMD/batch file? I have a Command Script( .cmd) and one of the command require admin right to run. I am NOT looking for right-click "Run as administrator", I would like the script itself to call the UAC prompt.Thank you, Ray
March 17th, 2010 11:45pm

Hi RayHow about "runas /user:Administrator" in the command?Trent
Free Windows Admin Tool Kit Click here and download it now
March 18th, 2010 4:24am

Hi,To elevate the permission, please refer to the following article:Windows7 elevated command prompt priviledges throug a scriptThanks,Novak
March 18th, 2010 9:57am

Thank you Trent,But the problem is, I woulld not know which user will be running the script.I am thinking of sending it to a bunch of guys. The UAC prompt can check their permission and if they are admin, all they have to do is say OK. Thanks,Ray
Free Windows Admin Tool Kit Click here and download it now
March 18th, 2010 11:07pm

Hi Ray, As you mentioned, if the user profile has administrator privilege, the script will be run without any problem. However, if the user do not have administrator privilege, you should add some command in the batch file. For more information about elevating privilege, please refer to above article. Thanks, Novak
March 19th, 2010 5:47am

I need to do the same! Just to be clear: I don't know neither the current user name, nor the admin password. I just need to ask the user via UAC, and if he confirm, run the script ITSELF as if it as been opened via "Run as administrator" menu. Thanks, Gianluigi Zanettini - http://www.megalab.it
Free Windows Admin Tool Kit Click here and download it now
March 21st, 2010 1:51pm

Hi, Been searching for the same issue. How can I automatically input the administrator password without having to type it in from the keyboard? My administrator account has a password.
November 28th, 2011 4:15am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics