Batch file 从批处理文件中捕获缺少的依赖项(dll)

Batch file 从批处理文件中捕获缺少的依赖项(dll),batch-file,exe,errorlevel,Batch File,Exe,Errorlevel,当从批处理中运行缺少依赖项的EXE时,我是否可以捕获错误? 在这种情况下,EXE无法加载,我们的应用程序日志为空 我尝试检查errorlevel,甚至尝试使用depends.EXE工具预先检查EXE 不管他们中有多少人工作 i、 e.mybat.exe 运行-this-app.exe 做些检查。。假设您知道依赖项是什么以及位置,那么您可以检查它们 if not exist "%windir%\system32\dependency1" goto :msg if not exist "%windi

当从批处理中运行缺少依赖项的EXE时,我是否可以捕获错误? 在这种情况下,EXE无法加载,我们的应用程序日志为空

我尝试检查errorlevel,甚至尝试使用depends.EXE工具预先检查EXE 不管他们中有多少人工作

i、 e.mybat.exe

运行-this-app.exe
做些检查。。假设您知道依赖项是什么以及位置,那么您可以检查它们

if not exist "%windir%\system32\dependency1" goto :msg
if not exist "%windir%\system32\dependency2" goto :msg
if not exist "%windir%\system32\dependency3" goto :msg
if not exist "%windir%\system32\dependency4" goto :msg

:: batch code here

goto :EOF    
:msg
echo you need the extra xyz filez...

您可以捕获应用程序输出。这就是您需要的吗?如果应用程序由于缺少依赖项而未加载,则不会有输出。。这正是我的问题通常情况下,若一个可执行文件并没有找到依赖项,它会在错误中抛出异常。所以它可以被抓住。这主要适用于控制台应用程序,UI应用程序可能会在MessageBox中抛出错误。这样,我必须为每个应用程序或版本更新脚本。我正在寻找更通用的解决方案。我正在寻找一种方法来识别这个错误,而不必显式地检查每个依赖项。