Re: batch question
- From: "Pegasus \(MVP\)" <I.can@xxxxxxx>
- Date: Mon, 16 Oct 2006 18:54:14 +1000
See below.
"David K" <noemails@xxxxxxxxxx> wrote in message
news:OCqyG8P8GHA.3384@xxxxxxxxxxxxxxxxxxxxxxx
Pegasus (MVP) wrote:
"David K" <noemails@xxxxxxxxxx> wrote in message
news:u73WmgO8GHA.3960@xxxxxxxxxxxxxxxxxxxxxxx
Pegasus (MVP) wrote:
"David K" <noemails@xxxxxxxxxx> wrote in messageThanks for replying, Peg
news:eww68BO8GHA.608@xxxxxxxxxxxxxxxxxxxxxxx
When I use the ping command in a batch file theThis is not a "problem" but is the way batch files work.
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
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
'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
.
- References:
- batch question
- From: David K
- Re: batch question
- From: Pegasus \(MVP\)
- Re: batch question
- From: David K
- Re: batch question
- From: Pegasus \(MVP\)
- Re: batch question
- From: David K
- batch question
- Prev by Date: Re: batch question
- Next by Date: Re: System Restarted suddenly
- Previous by thread: Re: batch question
- Next by thread: Re: How do I remove recycle bins from USB drives?
- Index(es):
Relevant Pages
|