I have several batch files that I call from a parent batch file. I need to trap if there are any errors that occur in the child batch files. When a child batch file makes a call to an exe file, I am able to trap the error in the child batch file just fine. How do I surface it up to the parent batch file?
我有几个批处理文件,我从父批处理文件调用。如果子批处理文件中出现任何错误,我需要陷阱。当子批处理文件调用exe文件时,我能够将错误捕获到子批处理文件中。如何将其显示到父批处理文件?
2 个解决方案
#1
Exit with:
exit /b errorlevel
In your child batch script.
在您的子批处理脚本中。
#2
Using exit /b %ERRORLEVEL%
in the called batch file should percolate it up nicely.
在调用的批处理文件中使用exit / b%ERRORLEVEL%应该很好地渗透它。
#1
Exit with:
exit /b errorlevel
In your child batch script.
在您的子批处理脚本中。
#2
Using exit /b %ERRORLEVEL%
in the called batch file should percolate it up nicely.
在调用的批处理文件中使用exit / b%ERRORLEVEL%应该很好地渗透它。