/*\这些特殊字符是不允许当成文件名的,所以会报错。这样吧,我把它们变成可命名的符号吧!
@echo off
(echo Str=Replace^(WScript.Arguments^(0^),WScript.Arguments^(1^),WScript.Arguments^(2^)^)
echo Wscript.Echo Str
echo Wscript.Quit)>Replace.VBS
for /r %%a in (*.txt) do (
set /p Str=<"%%~a"
call set "Str=%%Str:~,5%%"
call set "Str=%%Str:"="%%"
call :Replace "%%Str%%" "!" "!"
call :Replace "%%Str%%" "*" "*"
call :Replace "%%Str%%" "/" "/"
call :Replace "%%Str%%" "\" "\"
call :Replace "%%Str%%" ":" "∶"
call :Replace "%%Str%%" "?" "?"
call :Replace "%%Str%%" "|" "丨"
call :Replace "%%Str%%" "<" "〈"
call :Replace "%%Str%%" ">" "〉"
call :CheckExist "%%Str%%"
if defined num (
call echo 正在将 "%%~nxa" 重命名为 "%%Str%%_%%num%%%%~xa"
call ren "%%~a" "%%Str%%_%%num%%.rentmp"
) else (
call echo 正在将 "%%~nxa" 重命名为 "%%Str%%%%~xa"
call ren "%%~a" "%%Str%%.rentmp"
)
)
rem 郁闷,代码有点长,这里一下子不能全部贴上来
rem 请自行拼接上后面的代码
代码有点长了,超过回答字数,请麻烦你追答一下后,我再贴出后面的代码。