Saturday 3 March 2018

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




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?



Answer



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.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...