How do I elevate permissions from within a batch script in Windows 7 or 2008? [duplicate]

Possible Duplicate:
Batch file - start program with admin rights

I'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?


Solution 1:

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.