回复 1# U0BXS3
再给一个不用限定扩展名长度的版本
- @echo off &for /f "delims=" %%F in ('dir/b/s/a-d') do (
- set "F=%%F"&set "nF=%%~nF"&set "xF=%%~xF"&setlocal enabledelayedexpansion
- set "xH="&set "_xF=!xF!" & (call :cutHZ)
- if defined xH if "!xF!" neq "!xH!" (echo,ren "!F!" "!nF!!xH!" 2>nul)
- endlocal
- )
- pause&exit/b
- :cutHZ // 删除扩展名中包含的全部中文字符
- if "!_xF!"=="" (exit/b) else (
- set "c=!_xF:~,1!" &if "!c!" leq "Z" (set "xH=!xH!!c!")
- set "_xF=!_xF:~1!" &goto :cutHZ
- )
- exit/b
复制代码
|