@echo off
REM Script to add the current file's directory to the Windows PATH environment variable
REM This modifies the user PATH variable for the current user.

REM Get the current file's directory
setlocal
set "current_dir=%~dp0"
set "current_dir=%current_dir:~0,-1%" REM Remove trailing backslash

REM Display the directory to be added
echo Adding the following directory to PATH:
echo %current_dir%

REM Check if the directory is already in PATH
echo %PATH% | find "%current_dir%" >nul
if %errorlevel%==0 (
    echo The directory is already in the PATH variable.
    goto end
)

REM Add the directory to the user PATH
setx PATH "%PATH%;%current_dir%"
if %errorlevel%==0 (
    echo Successfully added %current_dir% to PATH.
) else (
    echo Failed to add %current_dir% to PATH. Ensure you have the necessary permissions.
)

:end
pause