我试图做一个batch fileclosures个人电脑,如果他们使用了允许的时间。 它将在启动时被触发,但是因为在Windows任务计划程序中不能有“如果和”触发器,所以有必要build立时间检查脚本。
我用下面的方法,但它不工作。 有人知道为什么吗?
IF "%TIME:~0,5%" GEQ "19:58" IF "%TIME:~0,5%" LSS "08:58" (MSG * "Your device has not been authorised for use at this time and will now shutdown." && SHUTDOWN -s -t 120)
尝试这个:
SET "ADJUSTEDTIME=%TIME: =0%" IF "%ADJUSTEDTIME:~0,5%" GEQ "19:58" GOTO :SHUTDOWN IF "%ADJUSTEDTIME:~0,5%" LSS "08:58" GOTO :SHUTDOWN GOTO :EOF :SHUTDOWN MSG * "Your device has not been authorised for use at this time and will now shutdown." SHUTDOWN -s -t 120