永发信息网

会“批处理”(.bat)的来一下

答案:1  悬赏:70  手机版
解决时间 2021-04-26 02:26
  • 提问者网友:鐵馬踏冰河
  • 2021-04-25 15:38

set TodayYear=%date:~0,4%
set TodayMon=%date:~5,2%
set TodayDay=%date:~8,2%
echo %TodayDay%
pause
set LastdayYear=
set LastdayMon=
set LastdayDay=
set LastdayYear=%TodayYear%
set LastdayMon=%TodayMon%
set /A LastdayDay=TodayDay-1
echo %LastdayDay%
pause

 

为什么我1日岛7日,都显示正常,今天开始最后一个变成了-1,把电脑时间调成9月9日夜市-1,调成9月10日,又正常了。

最佳答案
  • 五星知识达人网友:舍身薄凉客
  • 2021-04-25 17:13

加一行就行了


@echo off
set TodayYear=%date:~0,4%
set TodayMon=%date:~5,2%
set TodayDay=%date:~8,2%
for %%a in (08 09) do if %TodayDay%==%%a set TodayDay=%date:~9,1%
echo %TodayDay%
pause
set LastdayYear=
set LastdayMon=
set LastdayDay=
set LastdayYear=%TodayYear%
set LastdayMon=%TodayMon%
set /A LastdayDay=TodayDay-1
echo %LastdayDay%
pause


我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯