简化谈不上,照你的改了一点点.期待更好的代码- @echo off&setlocal enabledelayedexpansion
- :: 把日期转换成大写
- set str=零一二三四五六七八九
- for /f "tokens=1-3 delims=-" %%a in ("%date:~0,-4%") do (
- set /a y=%%a,d=%%b,m=%%c)
- for %%i in (d,m) do (if !%%i! geq 10 set %%i=!%%i:~0,1!十!%%i:~-1!
- set %%i=!%%i:0=!
- )
- set var=%y%年%d%月%m%日
- for /l %%i in (0,1,9) do (call set var=%%var:%%i=!str:~%%i,1!%%)
- echo %var%
- pause
复制代码
|