See below.
"David K" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Pegasus (MVP) wrote:
> > "David K" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >> Pegasus (MVP) wrote:
> >>> "David K" <(E-Mail Removed)> wrote in message
> >>> news:(E-Mail Removed)...
> >>>> When I use the ping command in a batch file the
> >>>> command is displayed over and over in the CMD
> >>>> window at great speed, without being executed.
> >>>>
> >>>> The batch files are textfiles called filename.bat,
> >>>> stored on the Windows XP desktop and invoked by
> >>>> mouse clicks.
> >>>>
> >>>> ping ip-address
> >>>> ping ip-address -t
> >>>>
> >>>> both exhibit this problem.
> >>>>
> >>>> Other commands such as tracert do not have this problem.
> >>>>
> >>>> Any ideas?
> >>>>
> >>>> David K
> >>>> Melbourne.au
> >>> This is not a "problem" but is the way batch files work.
> >>> You can easily overcome it by coding like so:
> >>>
> >>> @echo off
> >>> ping ip-address
> >>> ping ip-address -t
> >>> echo Press the Space Bar to close this window.
> >>> pause > nul
> >>>
> >>>
> >> Thanks for replying, Peg
> >>
> >> 'echo off' prevents display to the screen, making it useless 
> >> I can't see any other change that you've made.
> >>
> >> all I want is for the command to work inside a command prompt window.
> >> as aforementioned, the tracert command works as expected.
> >>
> >> If I type the same command 'ping ip-address' from within a dos window,
> >> it works fine.
> >>
> >> Cheers
> >>
> >> David Kinston
> >
> > Well, if you don't like "@echo off", omit it!
> >
> > You write "I can't see any other change that you've made."
> > Your original batch file had two lines. Mine has 5. Spot
> > the difference - it's essential!
> >
> >
>
> Your sarcasm is much appreciated, mate.
I'm afraid you asked for it.
> The differences consisted of 2 ping commands (only 1 is needed)
> plus a termination routine which is never executed. I did
> actually note them.
If these commands are never executed then I suspect that
you fell into a well-known trap: you are not executing ping.exe
but instead your own batch file called "ping.bat". Do not ever
call a batch file by the same name as a system program - it
causes lots of confusion!
> The first thing I did was to try out your solution - it resulted
> in a blank DOS window which simply stayed put - no doubt scrolling
> madly albeit invisibly without terminating.
I beg to disagree. However, unless you post the
version you actually ran, I cannot comment any
further. Let's have a look at it!
> Is that what you were aiming to achieve?
No, not at all. The line
echo Press the Space Bar to close this window.
will write a message to the screen, and this line
pause > nul
will pause the process until you press just about any key.
> If not, please consider how to create a batchfile which can be
> invoked by calling or clicking, which performs the ping
> command in a window, acting in the normal expected way.
>
> In the past I have had no difficulty doing this sort of thing.
>
> Thanks again
>
> David K
> melbourne.au
To resolve the matter, do this:
- Post your batch file.
- Start a Command Prompt (Start / Run / cmd {OK})
- Type the name of the batch file, e.g. "c:\Tools\MyBatch.bat" {Enter}
- Report exactly what happens.
Pegasus
Balwyn 3103