How do I run a batch file as an administrator in Vista without having to right click and choose "run as an administrator" every single time? I can't change the privilege level because it is disabled (greyed out).
-
ScuderiaConchiglia NBR Vaio Team Curmudgeon
Simply put, I don't think you can.
Gary -
davepermen Notebook Nobel Laureate
create a shortcut to it and set there "run as admin". but the uac prompt will logically still return
-
would this apply?
http://www.vistaclues.com/run-a-batch-file-as-an-administrator/
cheers ... -
Yeah, create a shortcut and in the shortcut properties set it to run as administrator. Once a shortcut's created, you can right-click it > Properties > Shortcut tab > Advanced > Run as administrator.
-
ScuderiaConchiglia NBR Vaio Team Curmudgeon
Link appears to be dead. Got another?
Gary -
That link is working for me.
-
Another option: Use the "runas" command. Type "runas /?" at a command prompt for more info.
-
Thanks. I did that but now I get a prompt that asks "windows need your permission to continue".
-
It works Gary, try again, I just checked it. Swarmer confirmed also from above.
cheers ... -
I believe that it is correct, this is different as "elevation" prompt, and the batch is running under administration mode. Try disabling UAC and test it out. I will look into it a bit more later when I get home.
cheers ... -
ScuderiaConchiglia NBR Vaio Team Curmudgeon
Yep, the link was fine last night when I checked it again. Twas a temporary glitch.
Gary -
Of course you do. UAC requires permission if you need to run something with elevated privileges. This isn't new; you were getting that prompt before too, after you right-clicked the batch file and did "Run as administrator". We just got rid of that part. So your batch file is now treated just like any other program requiring admin privileges.
If you don't want these prompts, you can turn off UAC. I don't recommend that though, since it means that all your programs will run with full permissions to modify the OS, change the system configuration, install things in the kernel, etc. But if you want to keep UAC on for most stuff, but you want to make an exception for particular shortcuts such as this one, follow these instructions to make the auto-elevating shortcuts: http://blogs.zdnet.com/Bott/?p=436&page=4
Running Batch File as an Administrator in Vista
Discussion in 'Windows OS and Software' started by hendra, Feb 18, 2009.