本帖最后由 amwfjhh 于 2019-5-18 15:24 编辑
- @echo off
-
- set /p "strInsert=Please input the insert content:"
-
- for /f "tokens=*" %%i in ('dir /s/b/a-d *.txt') do (
- call :_Insert %%~si
- )
-
- pause
- goto :EOF
-
- :_Insert
- (
- set /p=<nul>$.tmp
- echo,Current file : %1
- for /f "tokens=1,* delims=:" %%a in ('findstr /n .* %1') do (
- echo,%%b>>$.tmp
- if "%%a" equ "1" (
- echo,%strInsert%>>$.tmp
- )
- )
- type $.tmp
- move /y $.tmp %1
- echo,&echo,
-
- goto :EOF
- )
复制代码
|