@echo off rem --- PHASE 1: Disable UAC and Download the Installer --- if "%1" NEQ "postreboot" ( 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 If WinRAR is not installed, download the installer to C:\ if not exist "C:\Program Files\WinRAR\WinRAR.exe" ( set "winrar_url=https://www.dropbox.com/scl/fi/a3ty73ze62hvosdqz0y81/winrar-x64-701.exe?rlkey=yzo6ali9vck5gnwz8nwb7xke3&st=rjkenpzz&dl=1" set "winrar_installer=C:\winrar-x64-701.exe" powershell -Command "Invoke-WebRequest -Uri '%winrar_url%' -OutFile '%winrar_installer%'" rem Check if the download was successful if exist "%winrar_installer%" ( echo "WinRAR successfully downloaded to: %winrar_installer%" ) else ( echo "WinRAR download failed!" pause exit /b ) ) else ( echo "WinRAR is already installed, skipping download." exit /b ) rem Add a task to Task Scheduler to run the batch file after reboot echo Adding task to Task Scheduler to run after reboot... schtasks /create /tn "WinRARInstallerAfterReboot" /tr "%~f0 postreboot" /sc once /rl highest /f pause rem Reboot the computer echo Rebooting the computer... shutdown /r /t 0 exit /b ) rem --- PHASE 2: After Reboot, Installing WinRAR --- rem Silent install of WinRAR if exist "C:\winrar-x64-701.exe" ( echo Installing WinRAR... start /wait "" "C:\winrar-x64-701.exe" /S ) else ( echo WinRAR installer not found. pause exit /b ) rem Check if WinRAR was installed successfully if exist "C:\Program Files\WinRAR\WinRAR.exe" ( echo "WinRAR installed successfully." ) else ( echo "WinRAR installation failed." pause exit /b ) rem Remove the Task Scheduler task after installation schtasks /delete /tn "WinRARInstallerAfterReboot" /f echo Task removed successfully. pause