The problem has been solved. The 2nd floor told me how to do date arithmetic operations. I got inspiration from it. Because the thinking method of the 2nd floor would be wrong when crossing years during script running, so I directly judge the week character, which avoids this problem. The script is as follows (under 2000):
@echo off
set day=%date:~-10,4%%date:~-5,2%%date:~-2,2%
set date=%date:~-14,3%
if %date%==Monday set /a nextworkday=%day%+1&goto workday
if %date%==Tuesday set /a nextworkday=%day%+1&goto workday
if %date%==Wednesday set /a nextworkday=%day%+1&goto workday
if %date%==Thursday set /a nextworkday=%day%+1&goto workday
if %date%==Friday set /a nextworkday=%day%+3&goto workday
if %date%==Saturday set /a nextworkday=%day%+2&goto workday
if %date%==Sunday set /a nextworkday=%day%+1&goto workday
:workday
echo The next working day is: %nextworkday%
pause
There is another problem: why does the variable name have to be date to be effective when setting date multiple times? For example
set date=%date:~0,10%
set date=%date:-=%
The date variable is today's date 20070409
But if it is like this, it is invalid
set day=%date:~0,10%
set day=%date:-=%
The date is 2007-04-09, and the second set is invalid
Enabling delayed variables doesn't help
[ Last edited by lililulula on 2007-4-9 at 12:36 PM ]