我更习惯使用unix脚本。
findstr "ORA-[0-9]" alert_%%A.log>>%output-file%
在unix中我可以捕获返回错误:
if [ $? -ne 0 ]; then
echo "there is no ORA-ERROR found on alert log" > $ERRLOG
问题: 我怎么能在DOS /批处理文件中这样做?
答案 0 :(得分:0)
如果命令失败,%errorlevel%
变量会返回errorlevel
(扩展名为.bat
,而.cmd
扩展名会更改errorlevel
即使命令成功。)
所以,我猜测上面的unix命令在
的下面做了些什么if %errorlevel% neq 0 echo There is no ORA-ERROR found in alert log > %ERRLOG%
注意:强>
我很确定带有美元符号($
)的事情是变量,因此我将文件输出到变量。
希望有所帮助。