Pausing batch file execution

  • Thread starter Thread starter Jim Richards
  • Start date Start date
J

Jim Richards

I have forgotten how to pause the batch file execution while it is still in
the dos environment. I just want to see the last ECHO statement BEFORE
returning to windows XP Pro. Any help please, Jim
 
I have forgotten how to pause the batch file execution while it
is still in the dos environment. I just want to see the last
ECHO statement BEFORE returning to windows XP Pro. Any help
please, Jim

PAUSE

is typical.

C:\>pause /?
Suspends processing of a batch program and displays the message
Press any key to continue . . .
 
Jim Richards said:
I have forgotten how to pause the batch file execution while it is still in
the dos environment. I just want to see the last ECHO statement BEFORE
returning to windows XP Pro. Any help please, Jim

Pause works, or just run the batch from an open cmd prompt and the
screen will remain with the output from the batch command when it
completes.

Sleep (from the ResKit or Unx Win32 tools on Sourceforge.net) will let
you wait for some time period then continue.
 
Herb Martin said:
Sleep (from the ResKit or Unx Win32 tools on Sourceforge.net) will let
you wait for some time period then continue.

It also can be done without a third party utility.

19} How can one build a delay / sleep / wait procedure for a script?
195399 May 17 2007 ftp://garbo.uwasa.fi/pc/link/tscmd.zip
tscmd.zip Useful NT/2000/XP script tricks and tips, T.Salmi

All the best, Timo
 
Jim Richards said:
I have forgotten how to pause the batch file execution while it is still in
the dos environment. I just want to see the last ECHO statement BEFORE
returning to windows XP Pro. Any help please, Jim

....
echo last message>some_filename.txt
start "" notepad some_filename.txt


....not quite the same thing - but it might do what you want....
 
Jim Richards said:
I have forgotten how to pause the batch file execution while it is still in
the dos environment. I just want to see the last ECHO statement BEFORE
returning to windows XP Pro. Any help please, Jim

"while it is still in the dos environment" = "before the command prompt
window closes"; "returning to windows XP Pro" = "the command prompt window
closes".

This may seem like a trivial nitpick, however, it has been my experience
that simplifications (even those as easily understandable as the above)
sometimes obscure facts that it would otherwise be useful to keep in mind.
For one thing, even while a command prompt window is open, the o/s (windows
XP Pro) has not been left behind only to become active again once the batch
file has completed. The user might get the sense of "returning from the
execution of a batch file", but the o/s's viewpoint of the proceedings is
entirely different. Unfortunately (or fortunately) when it comes to a
disagreement about what should happen, the system itself is most often
right. But what else should you expect when it is the system's rules that we
are playing by?

As an aside, it is relatively simple to create a programming environment in
which the behavious of one's code is determined by the rules of the system.
If anyone could ever come up with a system that would carry out what we
intend rather than how we code it, well, that would be one wealthy
individual!

My apologies for a somewhat off-topic post; I was just feeling a bit
philosophical tonight.


/Al
 
Peter Wright said:
...
echo last message>some_filename.txt
start "" notepad some_filename.txt

If you are going there then why not wrap the entire batch
file in another where the call redirects both StdOut and
StdError into a text file, then opens the whole thing in the
text editor?

command 1>t.txt 2>&1

(use 1>>t.txt if you are appending to an existing file of course.)

But doing this is really not necessary if you set your command prompts
to have a (very) large scrollback buffer (I use 1500 or more lines usually)
and then just start from the open command prompt -- everything will
be right there on the screen and you can scroll back or copy/paste to a
notepad if you need to do so.
 
Timo Salmi said:
It also can be done without a third party utility.

19} How can one build a delay / sleep / wait procedure for a script?
195399 May 17 2007 ftp://garbo.uwasa.fi/pc/link/tscmd.zip
tscmd.zip Useful NT/2000/XP script tricks and tips, T.Salmi

All the best, Timo

or even better solution ;-)

ping 127.0.0.1 -n X > nul

where X is number of seconds to wait ;)

Y.
 
Back
Top