test_title.bat我需要的代碼的格式,只能算作奇數行
:GET_DOWNLOADS
set Counter=-1
for /f "DELIMS=" %%i in ('type version.txt') do (
set /a Counter+=2
set "Line_!Counter!=%%i"
)
if exist version.txt del version.txt
exit /b
:list_files
call :GET_DOWNLOADS
For /L %%C in (1,2,%Counter%) Do (
:: removing this part makes it work fine
set line=%%C
set /a line+=1
set /a line/=2
:: alternate way doesnt work either
REM set /a line=%line%/2
:: this part without the math part would be %%C instead of %Line%
echo %line%. !Line_%%C!
)
pause
(由編輯) 第二部分心不是由於某種原因,工作 它只是崩潰 如果我刪除,做行數學它工作正常,但改爲顯示1. 3. 5. 7.
version.txt
everything
0
minecraft
0
steam
0
obs
0
固定test_list.bat:d
@echo off
setlocal enabledelayedexpansion
set "num=1"
set "counter=0"
for /f "DELIMS=" %%i in (version.txt) do (
set /a num+=1
if "!num!"=="2" (set /a counter+=1&set "line_!counter!=%%i"&set num=0)
)
echo.
For /L %%C in (1,1,%Counter%) Do (echo %%C. !Line_%%C!)
pause
這是整個腳本。 – MarioMasta64