本帖最后由 /zhqsystem/zhq 于 2016-12-8 00:46 编辑
回复 1# bat9527
- for /f "delims=" %%i in ('type "%~f1"')do (set "not="
- for /f "delims=/" %%j in ("%%i")do if /i "%%~nj"=="G2003" (
- for /f "tokens=1,* delims=-" %%j in ("%%i")do (
- for /l %%n in (1,1,8)do if "%%~nk"=="%%n" set "not=y"
- if defined not (
- echo,%%j
- )else (
- echo,%%i
- )
- )
- )
- )
复制代码
依据楼下PCL大神指点追加,都不需要变量延迟执行,注:如果变量超过占用内存极限用建立和判断临时文件方式进行
- for /l %%n in (1,1,8)do set "-%%n=y"
- for /f "delims=" %%i in ('type "%~f1"')do (
- for /f "delims=/" %%j in ("%%i")do if /i "%%~nj"=="G2003" (
- for /f "tokens=1,* delims=-" %%j in ("%%i")do (
- if defined -%%~nk (
- echo,%%j
- )else (
- echo,%%i
- )
- )
- )
- )
复制代码
|