@echo off :: Check for administrative privileges (optional, but good practice if setting system-wide. For User-level PATH, admin is not strictly required) :: Recommended to set this for both scenarios! net session >nul 2>&1 if %errorLevel% neq 0 ( echo Setting Gradle to User Environment Variables... ) else ( echo Setting Gradle to System Environment Variables... ) :: The correct gradle path must be supplied :: Define the Gradle bin path set "GRADLE_PATH=D:\Modding_tools\gradle-9.6.1\bin" :: Fetch current User PATH, append the Gradle path, and update it permanently using PowerShell to avoid registry length limits and duplication issues powershell -Command "[Environment]::SetEnvironmentVariable('PATH', $env:PATH + ';%GRADLE_PATH%', 'User')" echo. echo ======================================================== echo Gradle path (%GRADLE_PATH%) has been added successfully! echo Please restart your command prompt or terminal for changes to take effect. echo ======================================================== pause