本帖最后由 miqilaosu 于 2019-6-18 11:25 编辑
- @echo off
- setlocal enabledelayedexpansion
- set n=1
- for /f "delims=" %%i in (123.txt) do (
- if !n!==1 (
- echo,Hello %%i
- set /a n=5
- ) else echo,%%i World
-
- )
-
复制代码 这种方法也可以判断奇偶数- @echo off
- setlocal enabledelayedexpansion
- set n=1
- (for /f "delims=" %%i in (123.txt) do (
- set /a m=!n!%%2
- set /a n+=1
- if !m! ==0 (
- echo,%%i World
- ) else echo,Hello %%i
-
- )
- )>1234.txt
复制代码
|