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


  1. Posts : 13
    Windows 7 Ultimate x32
       #1

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


    Hello,

    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?
    Code:
     
    @ECHO OFF
    ECHO.
    REGEDIT /S "%systemroot%\Setup\Scripts\MyTweaks.reg"
    EXIT
    Regards
      My Computer


  2. Posts : 13
    Windows 7 Ultimate x32
    Thread Starter
       #2

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

    Code:
     
    ; Remove Control Panel from the Windows 7 Explorer Navigation Panel
    [HKEY_CLASSES_ROOT\CLSID\{26EE0668-A00A-44D7-9371-BEB064C98683}\ShellFolder]"Attributes"=dword:a0900004
    ;--------------------------------------------------------------------------------
    ; Remove Favorites from the Windows 7 Explorer Navigation Panel
    [HKEY_CLASSES_ROOT\CLSID\{323CA680-C24D-4099-B94D-446DD2D7249E}\ShellFolder]"Attributes"=dword:a9400100
    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?

    Regards
      My Computer


  3. Posts : 13
    Windows 7 Ultimate x32
    Thread Starter
       #3

    Got success HERE
      My Computer


  4. Posts : 51
    Windows 7 Home premium x64
       #4

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


 

  Related Discussions
Our Sites
Site Links
About 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 23:46.
Find Us