不知行否 , 使用前先测试 ,测试前先备份
保存为ansi编码的bat 放到mp4所在文件夹下运行
同名文本文件需要为无bom的utf-8 | @echo off&pause&chcp 936 >nul | | set "_@@fail=-重命名失败" | | set "_z=(" | | set "_y=)" | | | | chcp 65001>nul | | for /f "eol=/ delims=" %%a in ('dir /b "*.mp4"') do ( | | set "_@@oldname=%%a" | | set "A_ext=%%~xa" | | if exist "%%~na.txt" ( | | for /f "delims="eol^= %%b in ('type "%%~na.txt"') do ( | | for /f tokens^=1^ delims^="/\<>|:?*" %%i in ("%%b") do ( | | if "%%i" == "%%b" ( | | set "_@@new=%%i" | | set /a @@=0 | | call :aaa | | ) else ( | | set "_@@new=%%~na%_@@fail%" | | set /a @@=0 | | call :aaa | | ))))) | | pause&exit/b | | | | :aaa | | set /a @@+=1 | | if exist "%_@@new%%A_ext%" ( | | set "_@@new=%_@@new%%_z%%@@%%_y%" | | goto :aaa | | ) | | rename "%_@@oldname%" "%_@@new%%A_ext%" | | goto :eofCOPY |
|