避免修改自身,要把这个脚本扩展名改为.cmd- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('dir /s /b /a-d *.bat') do (
- set "flag="
- for /f "usebackq delims=" %%j in ("%%i") do (
- set str=%%j
- if "!str:set tiger=!"=="%%j" (echo,%%j>>$) else (
- if !flag! neq 1 (set flag=1&echo,set tiger=3m arm=1m>>$
- ) else (echo,%%j>>$)
- )
- )
- move $ %%i
- )
- pause
复制代码
|