Bat file shuts down to quickly without a pause

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
julesverne
Posts: 81
Joined: 19 Nov 2013 00:41

Bat file shuts down to quickly without a pause

#1 Post by julesverne » 27 Jan 2015 21:54

Has anyone ever created a batch script that will error out unless they put a pause in, or the old fashioned ping -n 20 127.0.0.1 1>nul ?

Cause that is what I'm experiencing. It is blowing my mind. Without the ping it closes. Is it possible my computer is too fast for the batch file? i7 win 64 bit 8 GB Ram

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Bat file shuts down to quickly without a pause

#2 Post by Squashman » 27 Jan 2015 22:12

I wish I was omniscient. Then I wouldn't need to see your batch file to deduce what is wrong with it.

julesverne
Posts: 81
Joined: 19 Nov 2013 00:41

Re: Bat file shuts down to quickly without a pause

#3 Post by julesverne » 27 Jan 2015 22:18

I understand the snarkiness squashman, and would write the same thing as you did. However, in this instance, I was just asking generally has anyone ever seen this? I googled it and couldn't find any evidence, but I know you all do a lot of bat script writing, and have seen mentioned on the forum a few times about sometimes the set command eating up memory. Didn't know if others have seen other oddities, such as something like this.

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Bat file shuts down to quickly without a pause

#4 Post by Squashman » 27 Jan 2015 22:58

julesverne wrote:Cause that is what I'm experiencing. It is blowing my mind. Without the ping it closes. Is it possible my computer is too fast for the batch file? i7 win 64 bit 8 GB Ram

julesverne wrote:However, in this instance, I was just asking generally has anyone ever seen this?

So what you are saying is your first comment wasn't really a real world experience and it really wasn't blowing your mind. Because if it was then you would have code to show us and it would not be a generally SPEAKING kind of comment.

julesverne
Posts: 81
Joined: 19 Nov 2013 00:41

Re: Bat file shuts down to quickly without a pause

#5 Post by julesverne » 27 Jan 2015 23:31

You're completely right @squashman I should've known better than to ask a question without including code. In the future I will refrain from doing so as they do invite sarcastic responses. And honestly I really appreciate this forum and I don't like seeing snarky comments as they are not helpful to anyone. But I will definitely take the blame for this one. My apologies everyone.

ShadowThief
Expert
Posts: 1167
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Bat file shuts down to quickly without a pause

#6 Post by ShadowThief » 28 Jan 2015 15:19

julesverne wrote:You're completely right @squashman I should've known better than to ask a question without including code. In the future I will refrain from doing so as they do invite sarcastic responses. And honestly I really appreciate this forum and I don't like seeing snarky comments as they are not helpful to anyone. But I will definitely take the blame for this one. My apologies everyone.

Oh, that's just Squashman being Squashman.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Bat file shuts down to quickly without a pause

#7 Post by foxidrive » 29 Jan 2015 08:54

julesverne wrote:Has anyone ever created a batch script that will error out unless they put a pause in


Are you asking if cmd will close the window if there is an error in the batch code? yes. It can and does.

In the MSDOS and Win9x days command.com had a debugging switch that would step through the lines of code - these days you have to use pause and figure out where the syntax error is that is causing this problem.

Samir
Posts: 384
Joined: 16 Jul 2013 12:00
Location: HSV
Contact:

Re: Bat file shuts down to quickly without a pause

#8 Post by Samir » 02 Feb 2015 10:56

foxidrive wrote:In the MSDOS and Win9x days command.com had a debugging switch that would step through the lines of code - these days you have to use pause and figure out where the syntax error is that is causing this problem.
I think you can still do this if you execute a new command interpreter running the batch file in modern versions of 'DOS'. I think I remember doing it several times for debugging in recent years and haven't been using real DOS or win9x.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Bat file shuts down to quickly without a pause

#9 Post by foxidrive » 02 Feb 2015 16:09

Samir wrote:
foxidrive wrote:In the MSDOS and Win9x days command.com had a debugging switch that would step through the lines of code - these days you have to use pause and figure out where the syntax error is that is causing this problem.
I think you can still do this if you execute a new command interpreter running the batch file in modern versions of 'DOS'.


Proof-of-concept code would be handy.

Samir
Posts: 384
Joined: 16 Jul 2013 12:00
Location: HSV
Contact:

Re: Bat file shuts down to quickly without a pause

#10 Post by Samir » 03 Feb 2015 06:11

foxidrive wrote:
Samir wrote:
foxidrive wrote:In the MSDOS and Win9x days command.com had a debugging switch that would step through the lines of code - these days you have to use pause and figure out where the syntax error is that is causing this problem.
I think you can still do this if you execute a new command interpreter running the batch file in modern versions of 'DOS'.


Proof-of-concept code would be handy.
Nope, not there on xp. I'll try it on my win9x boxes when I get back around them.

Post Reply