[SOLVED] Batch file abruptly terminating

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

[SOLVED] Batch file abruptly terminating

Post by Ambush Commander »

I've been ripping my hair out all afternoon trying to figure out what I'm doing wrong. When I call certain executables (the most flagrant of which is 7z from 7-zip) my batch scripts seem to abruptly terminate after that call, resulting in the rest of the code not getting executed. There are no error messages, etc: the script execution just stops.

Do any of you Windows gurus know what would cause an upper-level batch script to stop executing, and how to suppress it? I hazard it has something to do with error codes, but alas, my google-fu isn't powerful enough to divine the answers to my problems (batch documentation is horrendous!)
Last edited by Ambush Commander on Sun May 06, 2007 7:07 pm, edited 1 time in total.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

I found that piping the program output to something else (such as cat) fixes the problem. Yay!
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Here's an alternate solution:

Code: Select all

call command
Much more elegant.
Post Reply