- @echo off
- setlocal enabledelayedexpansion
- cd /d "%~dp0"
- for /f "delims=" %%A in ('dir /a-d /b *.txt') do (
- set flag=
- for /f "usebackq" %%B in ("%%~A") do (
- set line=%%B
- if "!line:~-1!"=="2" (
- set flag=1
- ) else if "!line:~-1!"=="*" (
- set flag=1
- )
- )
- if defined flag ren "%%A" "Yes_%%A"
- )
-
- endlocal
- pause
复制代码
|