Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

marked as duplicate by Ƭᴇcʜιᴇ007, Mehper C. Palavuzlar, haimg, Mokubai, Sathya Dec 29 '11 at 12:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

If batch files could elevate themselves and circumvent UAC, then malware would have a heyday. :) – Ƭᴇcʜιᴇ007 Dec 28 '11 at 21:19
@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. – surfasb Dec 28 '11 at 21:37
I was thinking more along the lines of triggering UAC dialog box – Andrey Dec 28 '11 at 21:45
up vote 4 down vote accepted

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.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged .