Terminating of command file on failure of any exe

A

Ankit

Dear All,

I have a problem in terminating a batch Job. Suppose, I am having a
command file abcd.cmd.

Now say abcd.cmd invokes exe in the order:

call 1.exe
call 2.exe
call 3.exe
call 4.exe

Which means after 1.exe is over 2.exe will be invoked automatically.
But, the problem in my case even if the executable 1.exe fails, 2.exe
keeps on running. I want to stop the execution of 2.exe if 1.exe
fails.

What to do?

Regards & Thanks,
Ankit R.
M.S
 
P

Pegasus \(MVP\)

Ankit said:
Dear All,

I have a problem in terminating a batch Job. Suppose, I am having a
command file abcd.cmd.

Now say abcd.cmd invokes exe in the order:

call 1.exe
call 2.exe
call 3.exe
call 4.exe

Which means after 1.exe is over 2.exe will be invoked automatically.
But, the problem in my case even if the executable 1.exe fails, 2.exe
keeps on running. I want to stop the execution of 2.exe if 1.exe
fails.

What to do?

Regards & Thanks,
Ankit R.
M.S

Try this:
@echo off
1.exe || goto :eof
2.exe || goto :eof
3.exe || goto :eof
4.exe

Not that the "call" instruction you use is superfluous. It is only
required when you "call" another batch or command file.
 

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

Top