批量替换同目录内文件名中某个字符串
@echo off set /p str1='-上传图片': set /p str2='': echo. echo 正在修改文件(夹)名中,请稍候…… for /f "delims=" %%a in ('dir /s /b ^|sort /+65535') do ( if "%%~nxa" neq "%~nx0" ( set "file=%%a" set "name=%%~na" set "extension=%%~xa" call set "name=%%name:%str1%=%str2%%%" setlocal enabledelayedexpansion ren "!file!" "!name!!extension!" 2>nul endlocal ) ) exit
保存到需要替换的目录,文件名保存为 *.bat 格式