自附一段代码,有待改进:- echo off&cls
- setlocal enabledelayedexpansion
-
- set skip=2
- set filename=1.txt
-
-
- set /a skip=skip-1
- set /a tmp1=1
- if !skip! equ 0 (call :不大于0) else call :大于0
- (del %tmp%\temp.tmp & del %tmp%\tmp2.tmp)2>nul
- goto :eof
-
-
- :大于0
- more +!skip! !filename! >%tmp%\temp.tmp
- :start1
- more +!tmp1! %tmp%\temp.tmp >%tmp%\tmp2.tmp
- <tmp2.tmp set /p msg=
-
-
- REM 这里写for里的代码:
- echo.!msg!
- pause
-
- set /a tmp1+=1
- if "!msg!" equ "!tmp2!" goto :eof
- set tmp2=!msg!
- goto :start1
复制代码 试了下,貌似模拟skip成功了
for的话,是酱紫:- echo off&cls
- for /f "skip=2" %%a in (1.txt) do echo.%%a&&pause
复制代码 也可当成一个练习咯。
欢迎大家补充。 |