script

  • Thread starter Thread starter RedLars
  • Start date Start date
R

RedLars

Hi,

The following command checks, using an internal utility dllchecker, if
the a file has a dependency to ole32.dll. The result is either 0 or 1
which is outputed to the console.

DllChecker.exe /m someRandomFile.dll | find /c "ole32.dll"

In a bat script I'd like to iterate through a list of files performing
the above action. However, how can I use the result of said action in
an if - else expression? Say if file abc.dll has 1 instance of
ole32.dll I'd like to ouput "yes" otherwise "no".

So far I got;

for /r %%f in (*.dll) do (DllChecker.exe /m %%f | find /c "ole32.dll")

Appreciate any help.
 
RedLars,

Try asking your question in a scripting newsgroup:

microsoft.public.scripting.vbscript
microsoft.public.scripting.wsh
...
 
RedLars said:
Hi,

The following command checks, using an internal utility dllchecker, if
the a file has a dependency to ole32.dll. The result is either 0 or 1
which is outputed to the console.

DllChecker.exe /m someRandomFile.dll | find /c "ole32.dll"

In a bat script I'd like to iterate through a list of files performing
the above action. However, how can I use the result of said action in
an if - else expression? Say if file abc.dll has 1 instance of
ole32.dll I'd like to ouput "yes" otherwise "no".

So far I got;

for /r %%f in (*.dll) do (DllChecker.exe /m %%f | find /c "ole32.dll")

Appreciate any help.

Try this untested script, largely based on your own code. Watch
out for the single/double quotes!

for /r %%f in (*.dll) do call :Sub %%f
goto :eof

:sub
for /F %%a in ('DllChecker.exe /m %1 ^| find /c "ole32.dll"') do count=%%a
if %count%==1 (echo Yes) else (echo no)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top