本帖最后由 cutebe 于 2012-12-13 20:32 编辑
- @ECHO OFF
- SETLOCAL ENABLEDELAYEDEXPANSION
- SET FG=---
- FOR /F "DELIMS=" %%T IN ('DIR/B *.TXT')DO (
- SET ORS=&SET ORT=&SET TIT=&SET A=
- CALL :CN "%%T"
- ECHO,REN "%%T" "!ORT!!TIT!!ORS:/=!%%~XT"
- )
- PAUSE
- GOTO :EOF
- :CN FILE
- FOR /F "SKIP=1 TOKENS=1* DELIMS=:" %%M IN ('TYPE "%~1"^|FINDSTR /N .*')DO (
- SET "S=%%N "
- IF %%M#==2# SET "ORS=!S:~60,12!"
- IF %%M#==3# SET "ORT=!S:~4,5!"
- IF NOT "!S:%FG%=!"=="!S!" IF NOT DEFINED A SET/aA=%%M+3
- IF %%M#==!A!# SET "TIT=!S!"&GOTO :EOF
- )
复制代码
|