@echo off
set "filename=Plugins.txt"
set "line_to_remove=AltarGymNavigation.esp"
set "tempfile=temp.txt"

if not exist "%filename%" (
    echo File not found: %filename%
    goto end
)

find /c /i "%line_to_remove%" "%filename%" >nul
if %errorlevel% == 1 (
    echo Gym already disabled.
    goto end
)
attrib -R %filename%

(for /f "delims=" %%A in (%filename%) do (
if "%%A" neq "%line_to_remove%" echo %%A
)) > "%tempfile%"

move "%tempfile%" "%filename%" > nul

attrib +R %filename%

echo Disabled Gym.

:end
pause