Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm currently running a startup script in form of a bat file successfully in Windows 7 (I've inserted a new registry key entry with the bat file path as value in

Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run).

Now I need to run another bat file at startup, but with elevated rights (as administrator), and without manually confirming a prompt.

How can I achieve this, preferrably without external programs?

share|improve this question
Does this one have a solution? serverfault.com/questions/429364/… – Radek Sep 18 '12 at 6:55

6 Answers

See this article : Make Vista launch UAC restricted programs at startup with Task Scheduler.

This article shows how to use the Task Scheduler to launch startup programs with elevated privileges. Some small changes may be required in your case, but the article is well-written with screenshots.

share|improve this answer

Make two batch files:

StartAs.bat contains something along the lines of:

runas /user:SomeLocalAdminAccount c:\Users\MyUser\StartupWhat.bat

StartWhat.bat contains the commands that you want to run.

share|improve this answer
Still asks that the file be run with elevated priveledges – Joe Taylor Sep 27 '11 at 13:45

Have you thought of a different approach? Either a pure group policy for the equivelent registry setting, else setting the batch file to run as a group policy. It maybe that you could even run it as a computer script, rather than a user script.

Start with gpedit.msc. However, it does need Ultimate or one of the other top end editions.

share|improve this answer

AutoExnt utility, from the Resource Kit.

The AutoExNT service permits an administrator to configure a Windows based computer to run a custom batch file when first starting the computer. Also, a user or administrator is not required to be logged on at the time this custom batch file runs.

share|improve this answer

runas /user:SomeLocalAdminAccount

Here must be like this:

runas /noprofile /user:mymachine\administrator cmd

runas /profile /env /user:mydomain\admin "mmc %windir%\system32\dsa.msc

runas /env /user:user@domain.microsoft.com "notepad \"my file.txt\""
share|improve this answer
1  
Still asks that the file be run with elevated priveledges – Joe Taylor Sep 27 '11 at 13:45

You can also make a shortcut and specify that the shortcut's file should be run elevated.

(It's in some advanced options box.)

share|improve this answer
This doesn't work for shortcuts to bat files. Try it. – Joe Taylor Sep 27 '11 at 13:43

protected by studiohack Apr 27 '11 at 1:43

This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.

Not the answer you're looking for? Browse other questions tagged or ask your own question.