2. 但如果我们只想要日期中的year month day,可以自己定义设置显示日期。
%date:~x,y% x的意思是开始位置。 y的意思是取的字数。
echo %date:~0,4%%date:~5,2%%date:~8,2%
得到的结果是20230116