Terminating of command file on failure of any exe

  • Thread starter Thread starter Ankit
  • Start date Start date
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
 
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.
 
Back
Top