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

I am not trying to do cheeky things, but my need is just to have two scripts for adding or removing IP routes using the following command in batch scripts:

Add route:

@echo off
route add -p mask

delete route:

@echo off
route delete

My question is that now I cannot get it run just by double-click on the batch file. I always have to right click and choose: Run as Administrator option even my user is in the Administrator group.

Is there any way to introduce a command like sudo in Linux or anything else that can make me happy by just double-clicking on the file.


I tried the runas solution here but as the answer state:

Note, however, that this is not exactly like sudo - you can't use it to elevate yourself, just run something as a different user. If you're already have administrative rights, a runas to your account will give you the same access as the regular command (unless, of course, you runas a different administrator account, which will grant those administrator's rights to the new shell).

It is not a solution for my problem.

share|improve this question

marked as duplicate by Ƭᴇcʜιᴇ007, Tog, Kevin Panko, David, SgtOJ Feb 23 '14 at 23:09

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.

Basically you want to force those batch files to run with administrator rights, isn't it? – and31415 Feb 19 '14 at 17:45
Yes exaclty; I saw some post with runas option but it does not look to be helpful. – ruffp Feb 19 '14 at 17:48
@ruffp There is more than one answer on those questions, and I'm not sure why you wouldn't find the posts regarding RunAs 'helpful', but hey, there they are. :) – Ƭᴇcʜιᴇ007 Feb 19 '14 at 17:52
None of those answers work for you in any way? What "doesn't work" about them? – Ƭᴇcʜιᴇ007 Feb 19 '14 at 17:58
up vote 2 down vote accepted

Create a shortcut to such batch script and then

  • in context menu click Properties
  • under Shortcut click Advanced button
  • select Run as administrator
share|improve this answer
Ah it is funny to see the "run as administrator" is grayed out on the batch file but another option exist on the shortcut (and the same option is still greyed out on the shortcut). Thanlks anyway it is the simplest way I will use. – ruffp Feb 19 '14 at 19:56

As you mentioned in your comments using runas as the same user will not elevate you. There is no method I know of built in to windows that will elevate an already running command prompt.

In the past I have used 3rd party tools like Elevate.exe which will do the job for you, you just use it like you would use runas, just add the elevate program to your PATH variable and you can just do

elevate route add -p mask
share|improve this answer

I use "eldo" and "eldoGUI" for this purpose (running batch files elevated). They are available here, although I have absolutely no idea who created them in the first place.

Call eldoGUI like this:

Z:\eldoGUI.exe Z:\Backup-Music.cmd

This will produce the usual UAC prompt and proceed to run the command.

share|improve this answer

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