【BAT】中文数字to阿拉伯数字转换

时间:2022-02-05 01:22:58


将下面脚本保存到文本文档,另存为后缀.bat ,运行即可。
功能:将当前目录下所有文件文件名中的中文数字改为英文数字。

@echo off
for /f  "delims=" %%i in ('dir /b') do call :Replacement "%%i"
exit
:Replacement
set t1=%~1
set t1=%t1:九十=90%
set t1=%t1:八十=80%
set t1=%t1:七十=70%
set t1=%t1:六十=60%
set t1=%t1:五十=50%
set t1=%t1:四十=40%
set t1=%t1:三十=30%
set t1=%t1:二十=20%
set t1=%t1:十一=11%
set t1=%t1:十二=12%
set t1=%t1:十三=13%
set t1=%t1:十四=14%
set t1=%t1:十五=15%
set t1=%t1:十六=16%
set t1=%t1:十七=17%
set t1=%t1:十八=18%
set t1=%t1:十九=19%
set t1=%t1:十=10%
set t1=%t1:九=9%
set t1=%t1:八=8%
set t1=%t1:七=7%
set t1=%t1:六=6%
set t1=%t1:五=5%
set t1=%t1:四=4%
set t1=%t1:三=3%
set t1=%t1:二=2%
set t1=%t1:一=1%
set t1=%t1:零=0%
set t1=%t1:09=9%
set t1=%t1:08=8%
set t1=%t1:07=7%
set t1=%t1:06=6%
set t1=%t1:05=5%
set t1=%t1:04=4%
set t1=%t1:03=3%
set t1=%t1:02=2%
set t1=%t1:01=1%
echo %t1%
ren %1 "%t1%" 
goto :eof