- @echo off
- setlocal enabledelayedexpansion
- REM 设置在第几行插入
- set "Line=3"
- REM 设置行首
- set "Prefix=BAT"
- REM 设置行尾
- set "Suffix=VBS"
-
- for %%a in (*.txt) do (
- (for /f "tokens=1* delims=:" %%i in ('findstr /n .* "%%a"') do (
- if %%i equ !Line! (
- echo,%Prefix%%%j%Suffix%
- ) else (
- echo,%%j
- )
- ))>"%%a.tmp"
- move "%%a.tmp" "%%a"
- )
复制代码
|