@echo off :: BatchGotAdmin :------------------------------------- >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" if '%errorlevel%' NEQ '0' ( echo Requesting administrative privileges... goto UACPrompt ) else ( goto gotAdmin ) :UACPrompt echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" set params = %*:"="" echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" exit /B :gotAdmin pushd "%CD%" CD /D "%~dp0" :-------------------------------------- rem --- Check if WinRAR is already installed --- if exist "C:\Program Files\WinRAR\WinRAR.exe" ( echo WinRAR is already installed, skipping UAC disable and reboot. exit /b ) rem --- Disable UAC --- echo Disabling UAC... reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v EnableLUA /t REG_DWORD /d 0 /f echo UAC has been disabled. Please reboot for changes to take effect. pause rem --- Get the current directory (where this bat file is located) --- set "current_dir=%~dp0" rem --- Add task to Task Scheduler to run wnrr.bat after reboot --- echo Adding task to Task Scheduler to run wnrr.bat after reboot... schtasks /create /tn "RunWinRARBat" /tr "\"%current_dir%wnrr.bat\"" /sc onlogon /ru "%username%" /rl highest /f pause rem --- Reboot the computer --- echo Rebooting the computer... shutdown /r /t 0