Batch file 如何在批处理文件中添加日期条件
我的启动文件夹中有一个批处理文件。如何在批处理文件中添加一个条件,使其仅在系统日期介于当月的第5-25日之间且日期为上午6-11时执行命令。Batch file 如何在批处理文件中添加日期条件,batch-file,cmd,scheduled-tasks,Batch File,Cmd,Scheduled Tasks,我的启动文件夹中有一个批处理文件。如何在批处理文件中添加一个条件,使其仅在系统日期介于当月的第5-25日之间且日期为上午6-11时执行命令。 我无法将任务计划程序用于此任务 提前谢谢 @echo关闭 @echo off pushd "%temp%" makecab /D RptFileName=~.rpt /D InfFileName=~.inf /f nul >nul for /f "tokens=3-7" %%a in ('find /i "makecab"^<~.rpt') d
我无法将任务计划程序用于此任务 提前谢谢
@echo关闭
@echo off
pushd "%temp%"
makecab /D RptFileName=~.rpt /D InfFileName=~.inf /f nul >nul
for /f "tokens=3-7" %%a in ('find /i "makecab"^<~.rpt') do (
set "current-date=%%e-%%b-%%c"
set "current-time=%%d"
set "weekday=%%a"
)
del ~.*
popd
rem echo %current-time%
for /f "tokens=1,2,3 delims=-" %%a in ("%current-date% ") do (
set year=%%a
set mon=%%b
set day=%%c
)
echo %day%
for /f "tokens=1,2,3 delims=:" %%a in ("%current-time% ") do (
set hh=%%a
set mm=%%b
set ss=%%c
)
echo %hh%
if %day% LEQ 25 if %day% GEQ 5 if %hh% LEQ 11 if %hh% GEQ 6 (
echo execute my thing
)
pushd“%temp%”
makecab/D RptFileName=~.rpt/D InfFileName=~.inf/f nul>nul
对于('find/i“makecab”^中的/f“tokens=3-7”%%a,到目前为止没有任何效果