svh009 当前离线
列兵
0,孤勇者 1,人世间 2,从前说 5,错位时空 6,妈妈的话复制代码
0,孤勇者 1,人世间 2,从前说 error error 5,错位时空 6,妈妈的话复制代码
评分人数
孤勇者 人世间 从前说 error error 错位时空 妈妈的话复制代码
TOP
77七 当前离线
中校
@echo off setlocal enabledelayedexpansion for /f "tokens=1* delims=," %%a in ('type "1.txt"') do ( set /a n=%%a+1 set #!n!=%%b ) (for /l %%l in (1,1,%n%) do ( if "!#%%l!" equ "" ( echo error ) else ( echo !#%%l! ) ))>2.txt endlocal pause复制代码
qixiaobin0715 当前在线
大校
@echo off set n=0 setlocal enabledelayedexpansion (for /f "tokens=1* delims=," %%i in (1.txt) do ( set /a m=%%i-n if !m! neq 0 ( set /a x=%%i-m set /a y=%%i-1 for /l %%a in (!x!,1,!y!) do echo,error ) echo,%%i,%%j set /a n=%%i+1 ))>2.txt pause复制代码
0,孤勇者 1,人世间 2,从前说 error 5,错位时空 6,妈妈的话复制代码
terse 当前离线
中将
@echo off&setlocal enabledelayedexpansion for /f "tokens=1* delims=," %%i in (1.txt) do ( set _%%i=%%j set n=%%i ) for /l %%i in (0,1,!n!) do if defined _%%i (echo,%%i,!_%%i!) else echo,error pause复制代码
tmplinshi 当前离线
版主
@echo off call :main "1.txt" > "2.txt" exit /b :main <inputFile> setlocal set "index=" for /f "delims=, tokens=1,* usebackq" %%i in ("%~1") do ( if not defined index ( set /a index = %%i ) else ( set /a index += 1 ) setlocal enabledelayedexpansion if "%%i" neq "!index!" ( set /a indexEnd = %%i - 1 for /l %%a in (!index!, 1, !indexEnd!) do echo error endlocal & set /a index = %%i ) else ( endlocal ) echo %%i,%%j ) exit /b复制代码