这个脚本比较笨,但是实现了功能,还需完善,因为指定的时间间隔不能超过28天,而且系统的日期得是yyyy-mm-dd格式
@echo off
rem 目前这个数值不能指定太大不能超过28,只能在一个月范围内
set INPUTDAY=3
rem 如果date命令直接显示yyyy-mm-dd而不显示日期,那么不用采用~4
set TODAY=%date:~4%
rem ==取当前日期,采用取余数的方法====
for /f "tokens=1-3 delims=-/. " %%i in ("%TODAY%") do (
    set /a YEAR=%%i, MONTH=100%%j %% 100, DAY=100%%k %% 100
)
rem 当前天数减去输入的天数
set /a DAYBAK=%DAY% - %INPUTDAY%
rem 是否是闰月
set /a MONTHBAK=%MONTH% %% 2
rem ===========为小于0作准备==================================================
if /I %MONTH% EQU 1 (set /a UPMONTH1=12,YEAR1=%YEAR% - 1)
if /I %MONTH% GTR 1 (set /a UPMONTH1=%MONTH% - 1,YEAR1=%YEAR%)
echo %UPMONTH1%
set /a UPMONTHBAK1=%UPMONTH1% %% 2
if /I %UPMONTHBAK1% EQU 0 (if %UPMONTH1% EQU 2 (set /a DAYBAK1=28 + %DAYBAK%))
if /I %UPMONTHBAK1% EQU 0 (if %UPMONTH1% NEQ 2 (set /a DAYBAK1=30 + %DAYBAK%))
if /I %UPMONTHBAK1% GTR 0 (if %UPMONTH1% NEQ 2 (set /a DAYBAK1=31 + %DAYBAK%))
set /a MONTHBAK1=%UPMONTH1%
rem ===========================================================================

rem ============为等于0作准备==================================================
if /I %MONTH% EQU 1 (set /a UPMONTH2=12,YEAR2=%YEAR% - 1)
if /I %MONTH% GTR 1 (set /a UPMONTH2=%MONTH% - 1,YEAR2=%YEAR%)
echo %UPMONTH2%
set /a UPMONTHBAK2=%UPMONTH2% %% 2
if /I %UPMONTHBAK2% EQU 0 (if %UPMONTH2% EQU 2 (set /a DAYBAK2=28))
if /I %UPMONTHBAK2% EQU 0 (if %UPMONTH2% NEQ 2 (set /a DAYBAK2=30))
if /I %UPMONTHBAK2% GTR 0 (if %UPMONTH2% NEQ 2 (set /a DAYBAK2=31))
set /a MONTHBAK2=%UPMONTH2%
rem ===========================================================================
rem 相减天数大于0
if /I %DAYBAK% GTR 0 (
  echo zgweb%YEAR%-%MONTH%-%DAYBAK%
)
rem 相减天数等于0
if /I %DAYBAK% EQU 0 (
  rem set /a DAYBAK1=%DAYBAK% + %INPUTDAY%
  echo zgweb%YEAR2%-%MONTHBAK2%-%DAYBAK2%
)
rem 相减天数小于0
if /I %DAYBAK% LSS 0 (echo %YEAR1%-%MONTHBAK1%-%DAYBAK1%)