Catch missing dependency (dll) from a batch file

286 views Asked by At

Can I catch the error when an EXE with missing dependency is run from inside a batch? In such case the EXE fails to load and our app logs are empty

I tried checking the errorlevel and even tried to pre-check the EXE using depends.exe tool however non of them worked

i.e. mybat.exe

run-this-app.exe do some check.. do something

1

There are 1 answers

1
foxidrive On

Assuming you know what the dependencies are and the location then you can check for them.

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...