我有一个每天由预定的批处理文件启动的过程。如果出现错误,我需要内置错误处理以重新启动该过程。大多数时候一切都很好,但我每个月都会遇到一次超时错误,这是不可避免的。该进程不会向 bat 文件输出错误级别,因此我需要能够解析输出文件以确定进程是否需要重新启动。
我尝试使用该FOR /F
函数将第 12 行的内容作为变量传递给IF
语句,但我没有成功。我显然可以跳到第 12 行,但接下来我要处理其余行的标记。有没有人有任何建议我可以尝试?
一切正常时输出文件:
(为便于阅读添加了行号)
1 Pricing Script
2
3 ________________________________________________________________________
4
5 Retrieve Prices
6
7 Date of price file: 070912
8 Regular only
9 Connecting to server intdata.com
10 TCP/IP connection established
11
12 TySymb Interactive Data
+400 more lines
出错时的输出文件:
1 Pricing Script
2
3 ________________________________________________________________________
4
5 Retrieve Prices
6
7 Date of price file: 071012
8 Regular only
9 Connecting to server intdata.com
10 TCP/IP connection established
11 Time Out
12 General Time Out. The User ID and/or Password might be incorrect.