This batch script performs the following tasks: ### **UAC Elevation** 1. The...

August 23, 2025 at 05:54 PM

if exist "%vbs%" del "%vbs%" fsutil dirty query %systemdrive% >nul 2>nul || ( echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~s0", "%params%", "", "runas", 1 >> "%vbs%" "%vbs%" del "%vbs%" exit /B ) set DRIVERNAME=atvi-randgrid_sr_offline set EXENAME=sp24-cod.exe set DIRNAME=sp24 sc query %DRIVERNAME% >nul 2>&1 if %errorlevel%==0 ( echo AC already installed as %DRIVERNAME% goto startgame ) else ( goto install_ac_driver ) :install_ac_driver sc.exe create %DRIVERNAME% type= kernel binPath="%CD%\Randgrid.sys" sc.exe sdset %DRIVERNAME% D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWRPWPLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD) echo AC installed as %DRIVERNAME% :startgame if not exist %DIRNAME%\bootstrapper.exe ( copy bootstrapper.exe %DIRNAME%\bootstrapper.exe >nul copy bootstrapperCrashHandler.exe %DIRNAME%\bootstrapperCrashHandler.exe >nul ) cd %DIRNAME% echo Keep this window open to avoid issues! bootstrapper.exe %EXENAME% set BOOTSTRAPPERERRORLEVEL=%errorlevel% sc.exe delete %DRIVERNAME% taskkill /f /im bootstrapperCrashHandler.exe >nul 2>&1 del bootstrapper.exe del bootstrapperCrashHandler.exe if not %BOOTSTRAPPERERRORLEVEL%==0 ( echo. echo Failed to launch the game, check %DIRNAME%\bootstrapper.log! pause exit ) rd /s /q %APPDATA%\r4v3n_steam_files timeout 1 exit

This batch script performs the following tasks:

UAC Elevation

  1. The code begins by checking if UAC (User Account Control) elevation is needed:
    • if exist "%vbs%" del "%vbs%" - Checks for an existing VBScript file (%vbs%) and deletes it.
    • fsutil dirty query %systemdrive% - Tests if administrative privileges are required. If privileges are not granted (an error is encountered), the block below executes:
      • A VBScript snippet is dynamically created to invoke the batch script with elevated privileges using UAC (ShellExecute statement).
      • %vbs% is executed to elevate privileges and then deleted.
      • The script exits after attempting privilege elevation.

Driver Setup

  1. Checks for and sets up a kernel-mode driver:
    • set DRIVERNAME=atvi-randgrid_sr_offline - Specifies the driver name.
    • set EXENAME=sp24-cod.exe and set DIRNAME=sp24 - Specifies the executable (sp24-cod.exe) and directory (sp24) name for the game.
    • sc query %DRIVERNAME% - Queries if the driver (atvi-randgrid_sr_offline) is already installed.
      • If the driver exists (errorlevel == 0), it outputs a message and skips directly to the game launch (goto startgame).
      • If the driver does not exist (errorlevel != 0), it installs the driver via sc.exe create.
        • sc.exe create %DRIVERNAME% - Creates a kernel-mode driver service.
        • sc.exe sdset %DRIVERNAME% - Sets security permissions for the newly created driver.
        • Outputs a message indicating successful driver installation.

Game Execution

  1. Prepares for and launches the game:
    • Copies bootstrapper.exe and bootstrapperCrashHandler.exe into the game directory (sp24) if they do not already exist.
    • Changes into the game directory (cd %DIRNAME%) and launches bootstrapper.exe with the game executable (sp24-cod.exe).
    • Error Handling:
      • Captures the exit code of bootstrapper.exe into BOOTSTRAPPERERRORLEVEL.
      • If BOOTSTRAPPERERRORLEVEL != 0, displays an error message referring to the bootstrapper.log file in the game directory and exits.

Cleanup

  1. Performs cleanup tasks:
    • Deletes the installed driver using sc.exe delete %DRIVERNAME%.
    • Terminates and deletes any bootstrapperCrashHandler.exe instances.
    • Deletes the bootstrapper.exe and bootstrapperCrashHandler.exe files.
    • Removes a specific folder (%APPDATA%\r4v3n_steam_files) recursively and silently.
    • Waits for 1 second using timeout 1 before exiting.

Summary

  • Elevates the script to administrative privileges if necessary.
  • Checks for and installs a kernel-mode driver (Randgrid.sys) if not already installed.
  • Prepares the directory structure and resources for the game (sp24).
  • Launches the game and monitors the result.
  • Cleans up temporary files, removes the driver, and exits gracefully.
Generate your own explanations
Download our vscode extension
Read other generated explanations

Built by @thebuilderjr
Sponsored by beam analytics
Read our terms and privacy policy
Forked from openai-quickstart-node