【发布时间】:2014-11-03 23:31:11
【问题描述】:
我正忙于开发一个 cmd 程序(使用 Windows & 并以管理员身份运行 cmd),它将执行以下操作:
- 检测所有连接到网络的计算机并写入文本文件(这部分功能正常)
- 如果计算机时间相同,例如下午 12:00,则退出程序
程序如下:
@ECHO OFF
color a
: Begin
IF %Time% /t GTQ 01:15 && %Time% /t LEQ 01:20 (GOTO END) <---- problem is here
% %
% Date stamp the log entry and copy values. Wait 3 min before redoing the scan and check time %
% %
Time /t >> C:\Users\Paimon\Desktop\"WIFI data.txt"
Date /t >> C:\Users\Paimon\Desktop\"WIFI data.txt"
netstat -n
netstat -n >> C:\Users\Paimon\Desktop\"WIFI data.txt"
timeout /t 180
cls
GOTO Begin
:END
exit
我决定将时间与一个剧烈的值进行比较,因为程序每 3 分钟只执行一次特定的行。
【问题讨论】:
标签: windows if-statement time cmd compare