回复 3# LJY4.0 - @echo off
- setlocal enabledelayedexpansion
- cd /d "%~dp0"
- set str=abcd
- set /p t=输入格式[begin,end,replace,linenum]:
- for /f "tokens=1-4 delims=," %%A in ("%t%") do (
- set _1=%%A
- set _2=%%B
- set _3=%%C
- set _4=%%D
- )
- set n=1
- for /f "delims=" %%i in (a.txt) do (
- set str=%%i
- if !n! equ %_4% (
- echo !str:~0,%_1%!%_3%!str:~%_2%!
- ) else (
- echo %%i
- )
- set /a n+=1
- )
-
- endlocal
- pause
复制代码
|