@echo off title Steam ACF Read-Only Manager setlocal enabledelayedexpansion :: Collect files set i=0 for %%f in (*.acf) do ( set /a i+=1 set "file[!i!]=%%f" :: Get the game name set "name=" for /f "tokens=1,* delims= " %%a in ('findstr /C:"\"name\"" "%%f"') do ( set "name=%%~b" ) :: Check if read-only attrib %%f | find "R" >nul if !errorlevel! == 0 ( echo !i!. [R] !name! ^(%%f^) ) else ( echo !i!. [ ] !name! ^(%%f^) ) ) if %i% == 0 ( echo No files found with extension acf. goto :eof ) :: Ask for number :selection set /p "choice=Enter number to toggle read-only: " :: Validate if not defined file[%choice%] ( echo Invalid choice. Please try again. goto :selection ) set "target=!file[%choice%]!" :: Toggle read-only attrib %target% | find "R" >nul if %errorlevel%==0 ( attrib -r "%target%" echo Removed read-only from "%target%" ) else ( attrib +r "%target%" echo Set read-only on "%target%" ) :: Restart script endlocal set "choice=" cls %0