How do I elevate permissions from within a batch script in Windows 7 or 2008?
6,364
Using only a batch file? AFAIK, impossible. You'll need to fire off a VBscript or JScript, which can use the Shell.Execute.
You can look at some examples here or donwload the Elevate Powertoys, which are premade VBscripts and batchfiles you can use.
Also included in the Elevate Powertoys are examples on how to self elevate a batfile.
Related videos on Youtube
![Andrey](https://i.stack.imgur.com/gzru4.jpg?s=256&g=1)
Author by
Andrey
Updated on September 18, 2022Comments
-
Andrey almost 2 years
Possible Duplicate:
Batch file - start program with admin rightsI'm writing a batch script that requires administrator permissions to execute, so to start it I need to right-click and select "Run as Administrator". Is there a way to elevate permissions form within the script instead, like "su" in *nix?
-
Ƭᴇcʜιᴇ007 over 12 yearsIf batch files could elevate themselves and circumvent UAC, then malware would have a heyday. :)
-
surfasb over 12 years@techie007: This is true. But usually when folks say they need to elevate a script, it doesn't mean to circumvent UAC. Batchfiles have no built in method of even invoking a command that requires admin privileges. And the linked duplicate needs to be updated as that no longer works with UAC.
-
Andrey over 12 yearsI was thinking more along the lines of triggering UAC dialog box
-