简单的方法,假设您的日期格式为Mo 07/01/2013
,请使用以下命令进行检查echo %date%
:
@echo OFF &setlocal
REM %date% format is "Mo 07/01/2013"
FOR /f "tokens=2,4delims=/ " %%a IN ("%date%") DO SET /a month=%%a, year=%%b
IF %month% equ 1 (
SET /a month=12
SET /a year-=1
) ELSE SET /a month-=1
if %month% lss 10 SET "month=0%month%"
SET "folderToSearch=%year%.%month%"
IF NOT EXIST "D:\AuditFiles\%folderToSearch%\" ECHO Folder NOT found: %folderToSearch%&goto:eof
ZIP [put options for your ZIP app here] "D:\AuditFiles\Archive\%folderToSearch%.zip" "D:\AuditFiles\%folderToSearch%"