本帖最后由 flashercs 于 2019-11-9 14:59 编辑
- @echo off
- cd /d "%~dp0"
- set fx=*.txt
- set "sx=!!"
- for /f "delims=" %%i in ('dir /b %fx%')do (
- echo %%i
- set "n="
- for /f "delims=:" %%j in ('findstr /nc:"%sx%" "%%i"') do set /a n=%%j
- setlocal EnableDelayedExpansion
- if defined n (
- (
- for /L %%k in (!n!,-1,1) do (
- set input=
- set /p "input="
- echo,!input!
- )
- )<"%%i" >>tmp.zxy
- move /y tmp.zxy "%%i"
- )
- endlocal
- )
- pause
- exit /b
复制代码
|