- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个计划的批处理文件每天都会启动的过程。如果有错误,我需要内置错误处理才能重启进程。所有这些在大多数情况下都有效,但是我每个月都会收到一次超时错误,所以这是不可避免的。该进程不会将错误级别输出到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.
最佳答案
我只是使用FIND或FINDSTR在输出中查找错误消息。我不用担心行号。
find "General Time Out. The User ID and/or Password might be incorrect." "yourFile.log" && (
echo Timeout occurred, you must put code here to restart
)
findstr /c:"General Time Out. The User ID and/or Password might be incorrect." "yourFile.log" && (
echo Timeout occurred, you must put code here to restart
)
关于error-handling - BAT : Parse Output File For Error Handling,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11437306/
这段代码: class Bat{ public: Bat(); Bat(int i=0); virtual ~B
有没有办法摆脱整个测试文件?整个测试套件? 类似的东西 @test 'dependent pgm unzip' { command -v unzip || BAIL 'missing depend
我有一些 bats我运行以测试某些功能的脚本如何在脚本中回显 bats 文件名? 我的 bats 脚本如下所示: #!/usr/bin/env bats load test_helper echo $
我想创建一个 bat 文件,该文件创建一个文件列表和路径(MyList.txt)。将该文件保存到运行 bat 文件的同一目录中。 这就是我试图用 MyList.txt 完成的。我也想整理文件。 fil
有人可以教我如何使用 .bat 文件或建议更改代理设置吗? 老实说,我找不到有关的好信息。 我需要一个 .bat 文件,它将使用特定的代理 IP 和端口更改我的 Internet 设置(代理)。 谢谢
我想知道如何创建一个 bat 文件来执行在特定目录中找到的所有其他 bat 文件? 最佳答案 单向 for %%f in (c:\xxx\*.bat) do ( call %%f ) (要从同一
我想知道如何创建一个 bat 文件来执行在特定目录中找到的所有其他 bat 文件? 最佳答案 单向 for %%f in (c:\xxx\*.bat) do ( call %%f ) (要从同一
我需要创建 2 个 .bat 文件: 转储我的 PostgreSQL 数据库 恢复 PostgreSQL 数据库 如何将变量(数据库名称、登录名、密码等)移出到外部文件,以便两个 .bat 文件可以使
我正在尝试设置 Minecraft 服务器,实际上一切正常。我正在使用 launch.bat 文件启动服务器。 "%ProgramFiles%\Java\jre1.8.0_20\bin\java.ex
我在 Windows 2003 系统上,需要编写脚本来删除和创建 WebSphere Application Server 中的配置文件。这需要我调用 manageprofiles.bat 两次,一次
这里相对简单的事情没有一个容易发现的答案......我已经尝试了 start、/K 标志等的变体,但是每当我的批处理文件命中 servicecontroller 时行并运行该命令,它完成了命令,但之后
我正在尝试获取我的 commit-build.bat执行其他 .BAT 文件作为我们构建过程的一部分。 commit-build.bat的内容: "msbuild.bat" "unit-tests.b
我有一个要获取的实用程序脚本,其中包含两个提示用户输入的函数; anykey 和 yesno。 如何测试提示?提示文本不会显示在 $output 中。 此外,如何强制 yesno 中的 while 循
我有一个要获取的实用程序脚本,其中包含两个提示用户输入的函数; anykey 和 yesno。 如何测试提示?提示文本不会显示在 $output 中。 此外,如何强制 yesno 中的 while 循
我有一个 bat 文件,它根据文件名将每个文件放在一个文件夹中。但是,当我运行 bat 文件时,它也会将 bat 文件放在一个文件夹中。我想排除 bat 文件扩展名,因为我必须进入每个文件夹并剪切 b
我的机器上安装了 python.exe(多次),但没有安装 python.bat。我正在尝试构建 Chromium 嵌入式框架,主批处理文件显示 @echo off python.bat tools\
我想使用 master.bat 从不同位置执行多个 .bat 文件 我试过 Master.bat REM Echo Launch dir: "%~dp0" REM Echo Current dir:
嘿社区,我需要知道如何运行 .bat 文件以将文本字符串写入运行 .jar 的 .bat 文件以使用该命令。 用于运行其他批处理文件中的命令的批处理文件也将从 Windows 任务计划程序运行。 顺便
在C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC目录下,有两个.bat文件: ./vcvarsall.bat bin/vcvars32.b
我想在 tomcat 上部署时在 war 文件之外设置 application.properties 文件,这是我的观察 1. 当我将 jvm 属性设置为 spring.config.location
我是一名优秀的程序员,十分优秀!