PC Review


Reply
Thread Tools Rate Thread

batch question

 
 
David K
Guest
Posts: n/a
 
      16th Oct 2006
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
 
Reply With Quote
 
 
 
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      16th Oct 2006

"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


 
Reply With Quote
 
David K
Guest
Posts: n/a
 
      16th Oct 2006
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
 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      16th Oct 2006

"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!


 
Reply With Quote
 
David K
Guest
Posts: n/a
 
      16th Oct 2006
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.
The differences consisted of 2 ping commands (only 1 is needed)
plus a termination routine which is never executed. I did
actually note them.

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.

Is that what you were aiming to achieve?

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
 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      16th Oct 2006
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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: --->Batch command question<--- Jon Windows Vista General Discussion 0 6th Feb 2010 11:35 PM
Batch job question Pete Windows XP General 8 3rd May 2009 05:43 PM
Question about batch file programmernovice@yahoo.com Windows XP General 3 30th Jul 2006 05:05 AM
Batch question Howard Brazee Windows XP General 8 8th Dec 2005 06:27 PM
Re: Batch question Brother Brock Windows XP General 0 24th Aug 2005 10:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:23 PM.