联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
@echo off for /f "delims=" %%i in ('findstr "1 3 4 6 7" a.txt') do (set num=%%i >>test2.txt call,echo %%num%% ) pause
@echo off setlocal enabledelayedexpansion set row=0 type nul>"C:\test\test2.txt" for /f "tokens=1,2* delims=:" %%a in ('findstr /n .* "C:\test\test1.txt"') do ( set /a row+=1 if !row! equ 1 (>>"C:\test\test2.txt" echo %%b) if !row! equ 3 (>>"C:\test\test2.txt" echo %%b) if !row! equ 4 (>>"C:\test\test2.txt" echo %%b) if !row! equ 6 (>>"C:\test\test2.txt" echo %%b) if !row! equ 7 (>>"C:\test\test2.txt" echo %%b) )
Originally posted by HAT at 2008-5-27 11:15: @echo off setlocal enabledelayedexpansion set row=0 type nul>"C:\test\test2.txt" for /f "tokens=1,2* delims=:" %%a in ('findstr /n .* "C:\test\test1.txt"' ...
@echo off&setlocal enabledelayedexpansion for /f "delims=" %%i in (test1.txt) do ( set str=%%i if defined str ( set /a n+=1 set _!n!=!str! ) ) for %%i in (1 3 4 6 7) do echo !_%%i!>>test2.txt pause>nul
Originally posted by jia332 at 2008-5-31 10:47 AM: HAT兄 如果是空行为什么显示的是echo is off 而不是空行
@echo off&setlocal enabledelayedexpansion for /f "delims=" %%i in ('findstr/n ".*" test1.txt') do ( set str=%%i&set str=!str:*:=! set/a n+=1 set _!n!=!str! ) for %%i in (1 3 4 6 7) do echo.!_%%i!>>test2.txt pause
@echo off for %%a in (1 3 4 6 7) do set .%%a=a for /f "tokens=1* delims=:" %%a in ('findstr/n ".*" test1.txt') do ( if defined .%%a echo.%%b ) pause
Originally posted by 26933062 at 2008-5-31 14:29: [code] @echo off&setlocal enabledelayedexpansion for %%a in (1 3 4 6 7) do set .%%a=a for /f "tokens=1* delims=:" %%i in ('findstr/n ".*" test1.txt') do ( if defined . ...
Originally posted by terse at 2008-5-31 17:00: 楼兄笔误哦 %%i应该%%a 延迟也可以去了吧
Originally posted by 26933062 at 2008-5-31 14:29:@echo off for %%a in (1 3 4 6 7) do set .%%a=a for /f "tokens=1* delims=:" %%a in ('findstr/n ".*" test1.txt') do ( if defined .%%a echo.%%b ) pause[[i ...