Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Run elevated ("Run As Administrator") automatically in .BAT .CMD file

27 May 2011   #1

Windows 7 Ultimate x32
Run elevated ("Run As Administrator") automatically in .BAT .CMD file


I've prepared an unattended Win7 SP1 DVD, everything works just fine except a part of my registry tweaks (>100) MyTweaks.reg. After investigation, it proved that those registries must be run elevated ("Run As Administrator").

Here bellow, MyTweaks.bat. What to add/modify to make REGEDIT elevated runnig? Otherwise, is there a .cmd command abble doing that?
REGEDIT /S "%systemroot%\Setup\Scripts\MyTweaks.reg"

My System SpecsSystem Spec
27 May 2011   #2

Windows 7 Ultimate x32

I find that nircmd.exe from nirsoft can do easealy the job
Nircmd\NIRCMD.exe elevate REG import C:\Windows\Setup\Scripts\MyTweaks.reg
But still the following registries are NOT applied.

; Remove Control Panel from the Windows 7 Explorer Navigation Panel
; Remove Favorites from the Windows 7 Explorer Navigation Panel
On reflection, I noticed that the problem is NOT (or not only) run elevate. It's the Permissions forAdministrators group Full Control box not cheked Allow step 5 HERE.
Is there any how to do that automatically?

My System SpecsSystem Spec
27 May 2011   #3

Windows 7 Ultimate x32

Got success HERE
My System SpecsSystem Spec

02 Jul 2011   #4

Windows 7 Home premium x64

The winrar sfx can also run anything with admin rights you can select this in sfx options...
My System SpecsSystem Spec

 Run elevated ("Run As Administrator") automatically in .BAT .CMD file

Thread Tools

Similar help and support threads
Thread Forum
Run "cmd.exe" as a given user and "as administrator" in command line
Hello and thank you for reading my post. If I'm logged in Windows as user "u1", I can execute "cmd.exe" "as administrator" by choosing "Start" -> "cmd.exe" and right-click "Run as administrator".I would like to start another "cmd.exe" console as "u2" and "as administrator". (So, "u2" is not...
General Discussion
Setting Priority with "Elevated Shortcut without UAC Prompt Tutorial"
I used the info in Elevated Program Shortcut without UAC Prompt Tutorial and it soon dawned on me that the applications seemed to be taking a long time to run. Than the penny dropped - Scheduled Tasks run at priority 7 by default (which is lower than directly run applications typically run at)...
General Discussion
"File Access Denied" to a .TMP file, even to administrator
Hi there: While writing in a .xls file, a .TMP file has been inadvertently created: "original_filename.xls~RF17c85d1a.TMP" Although I'm the only user, and appear as the administrator, Windows won't let me delete the file, nor make any changes to its security and permissions settings, nor...
General Discussion
"File and Printer Sharing" keeps turning on automatically
Hi there, I am using Windos 7 Ultimate (x64). I am using internet via LAN (DSL connection). I am really very much concerned of the security of my Notebook. I have been experiencing a problem for, approximately, 2 weeks. Now the problem is , that in "Network and Sharing Center >...
Network & Sharing
All Users Desktop Files "Not Found" (Dir *.*) in Elevated Cmd Prompt
Re: Windows 7, SP1, Home Premium, 64-bit When using Q-Dir, a 4-pane Windows Explorer replacement, I can manually move desktop files/icons between the all users a/c and my account. I created a batch file to do this, and it works fine when clicked from within Q-Dir. It does not, however work from...
General Discussion
Question on "How to Create a Elevated Program Shortcut ..."
The solution (Shawn) in the thread How to Create a Elevated Program Shortcut without a UAC Prompt ( ends with 24. When you run this new elevated shortcut, you will now no longer have...
System Security

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 09:57.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App