.bat file for "keep open ping" not working after WinXPsp2 clean in

G

Guest

I've used a simple .bat file to recycle through a ping command in order to
keep open my internet connection through my cell phone when I use it. It's
always worked well through the many upgrades from sp1 to sp2 etc.

Now, because HP said they couldn't create me a boot disk, I had to do a
complete fresh install using an OEM WinXPsp2 (and new codes from a call to
MS). But, now, I cannot get the batch file to work. The cmd.exe window comes
up but no command lines are either shown or processed. I've tried disabling
my zone alarm firewall and rewriting the bat file- all to no avail..

To me, it seems like there's a setting not set right - one that might have
not overwritten defaults the first time when upgrading; but, now which
doesn't get set correctly during a fresh install.

Can someone tell me how to get a .bat file to work in order to Ping - using
WinXpxp2 ???
 
P

Pegasus \(MVP\)

rrjmd said:
I've used a simple .bat file to recycle through a ping command in order to
keep open my internet connection through my cell phone when I use it. It's
always worked well through the many upgrades from sp1 to sp2 etc.

Now, because HP said they couldn't create me a boot disk, I had to do a
complete fresh install using an OEM WinXPsp2 (and new codes from a call to
MS). But, now, I cannot get the batch file to work. The cmd.exe window comes
up but no command lines are either shown or processed. I've tried disabling
my zone alarm firewall and rewriting the bat file- all to no avail..

To me, it seems like there's a setting not set right - one that might have
not overwritten defaults the first time when upgrading; but, now which
doesn't get set correctly during a fresh install.

Can someone tell me how to get a .bat file to work in order to Ping - using
WinXpxp2 ???

@echo off
:again
ping www.google.com
ping localhost -n 120 > nul
goto again

If this does not work then you need to tell us exactly what
happens when you run it.

BTW, unless you enjoy re-inventing the wheel, you should
back up all tools (such as this one) and programs/drivers
(such as those you download from the Internet).
 
T

Tom Porterfield

rrjmd said:
I've used a simple .bat file to recycle through a ping command in order to
keep open my internet connection through my cell phone when I use it. It's
always worked well through the many upgrades from sp1 to sp2 etc.

Now, because HP said they couldn't create me a boot disk, I had to do a
complete fresh install using an OEM WinXPsp2 (and new codes from a call to
MS). But, now, I cannot get the batch file to work. The cmd.exe window
comes
up but no command lines are either shown or processed. I've tried
disabling
my zone alarm firewall and rewriting the bat file- all to no avail..

To me, it seems like there's a setting not set right - one that might have
not overwritten defaults the first time when upgrading; but, now which
doesn't get set correctly during a fresh install.

Can someone tell me how to get a .bat file to work in order to Ping -
using
WinXpxp2 ???


Could you post what is in the batch file?
 
G

Guest

thanks for your reply -- I copy pasted your bat file to notepad and "saveas"d
keepopen.bat. then I clicked on it which opened a new small window with a
black background and a header bar which read C:WINDOWS\system32\cmd.exe
[which is exactly what happened when I used my old batch file as well]. It
simply remained blank for about 30 sec then gave an error message: "the ping
request could not find host www.google.com. Please check the name and try
again." [Now this error message was new to me - my old bat file never even
got that far]

But: that's as far as it went. the curser returned and it just set there
processing no more instructions- I could not tell whether or not it actually
pinged or accessed the internet connection before it gave the error messages.

any more suggestions? thanks again in advance for your help.

BTW - I do back up files - the file that I referenced did work before I
restored my system/ not any more afterwards - that's the problem.
 
G

Guest

thanks for your reply -- I copy pasted a bat file from another thread to
notepad and "saveas"d
keepopen.bat. [

@echo off
:again
ping www.google.com
ping localhost -n 120 > nul
goto again

] then I clicked on it which opened a new small window with a
black background and a header bar which read C:WINDOWS\system32\cmd.exe
[which is exactly what happened when I used my old batch file as well]. It
simply remained blank for about 30 sec then gave an error message: "the ping
request could not find host www.google.com. Please check the name and try
again." [Now this error message was new to me - my old bat file never even
got that far]

But: that's as far as it went. the curser returned and it just set there
processing no more instructions- I could not tell whether or not it actually
pinged or accessed the internet connection before it gave the error messages.
 
P

Pegasus \(MVP\)

Try to walk before you run. In other words, before running
a ping command from within a batch file, run it from a command
prompt. This is how it works:
- Click Start / Run / cmd {OK}
- Type this command:
ping www.google.com

If you do not get a response then there is something wrong
with your network setup or with your Internet connection.
This has nothing at all to do with the batch file. Fix up your
Internet connection, then start working with the batch file!


rrjmd said:
thanks for your reply -- I copy pasted your bat file to notepad and "saveas"d
keepopen.bat. then I clicked on it which opened a new small window with a
black background and a header bar which read C:WINDOWS\system32\cmd.exe
[which is exactly what happened when I used my old batch file as well]. It
simply remained blank for about 30 sec then gave an error message: "the ping
request could not find host www.google.com. Please check the name and try
again." [Now this error message was new to me - my old bat file never even
got that far]

But: that's as far as it went. the curser returned and it just set there
processing no more instructions- I could not tell whether or not it actually
pinged or accessed the internet connection before it gave the error messages.

any more suggestions? thanks again in advance for your help.

BTW - I do back up files - the file that I referenced did work before I
restored my system/ not any more afterwards - that's the problem.




Pegasus (MVP) said:
@echo off
:again
ping www.google.com
ping localhost -n 120 > nul
goto again

If this does not work then you need to tell us exactly what
happens when you run it.

BTW, unless you enjoy re-inventing the wheel, you should
back up all tools (such as this one) and programs/drivers
(such as those you download from the Internet).
 
T

Tom Porterfield

rrjmd said:
thanks again for your reply. I should have said that before I sent the
message in I tried for weeks - pinging from the command line as well as
turning off zone alarm etc.

I did as you suggested, again, and it didn't work - the first time. Then
with simply pasting your suggested ping to google in the command line
again
and repeating - it worked! I got a response that it was pinging google and
recieving 4 packets back. then it hung.

So I used my "keepopen" bat again - and, lo, for the first time, it also
opened the new window, processed "ping www.1.google.com" - it recieved
four
responses - then it gave me the times - before it simply quit.

I don't know why, this time (out of about 100) it worked - I did nothing
different [except install 3 of today's window's security updates] but it
sort
of did work-- almost.

I don't know why it changed my ping from www.google.com to
www.1.google.com
- nor why it recieved four responses to my one ping - nor why it only did
it
once when I've got a "goto again" in the file.

after displaying the resulting times the cursor just did a [cr] and set
there blinking under the first character in the line above it [ but it did
NOT display the usual c:\\ prompt]

we're close but oh so far.


You're not far at all. You get four pings when the file first runs because
that is the default for the ping command. If you want only one, change the
third line of your batch file to the following:

ping -n 1 www.google.com

That tells it to ping www.google.com one time. You are being redirected to
www.1.google.com as google probably has a farm and traffic rolls to
different servers based on availability. Finally, you are getting no
response after the four pings of google because you are not waiting long
enough. The commands as provided ping google and then ping localhost 120
times. I assume this is there as you don't need to constantly ping google
to keep the connection open, so it pings google, then pings localhost 120
times just to do something. After the 120 pings of localhost it will then
ping google again. You don't see the pings to localhost in the output
window because of the redirect of output to the nul handle (> nul) that is
at the end of the forth line. Bump the 120 in that line down to a smaller
number if you want it to ping google more often, try 10 if you want to see
it after a short time.

Alternatively, instead of pinging localhost over and over to kill time, you
might try using a sleep utility that will basically sleep for a period of
time and then start your loop again. One such as available at
http://support.teloep.org/download.htm. Download and extract sleep.zip from
that page and then change your batch file as follows:

@echo off
:again
ping -n 1 www.google.com
sleep 10000
goto again

This will ping google only once, sleep for 10 seconds (the parameter to
sleep is in milliseconds) and then loop back and ping google again.
 
G

Guest

more in the saga:

I don't know why the cmd.exe began working the ping - it hasn't done it
before.

FIRST: I took out the no-echo and saw the commands being processed. The ping
worked from within the bat file; but, it seems to ONLY work when I've got IE
window open. If I try to run the bat file- CONNECTED to the internet, BUT
WITHOUT IE open - it does NOT process the commands - it gives me the error
message that it couldn't find www.google.com, try again and stops. If I open
IE - the bat file doesn't restart itself. but if (with ie open) I restart the
bat file it starts pinging again.

This is NOT how it worked B4 I did the complete reinstall. Before, even if
I wasn't connected to the internet the batch file would still work but give
non-halting error messages then continue on looping through the bat file
commands. But, like i said before, I don't know what settings are different
now.

SECOND: I took out the line "ping localhost -n 120 > nul" and now the bat
file does cycle. However it seems like it's pinging way too often (does it
hog bandwitdth and actually slow my surfing?) What does this command line
actually do? Whatever it is it doesn't seem to let the file cycle back to
"again:" often enough to keep my sprint connection open. If I use the file
without the line - it does keep it open (like I need) but it seems - to me-
that it slows down my overall browsing.

SO: what does that line to? Is it essential? Does it give a clue to any
settings that I've got which are wrong? Is there an alternative to slow the
pinging down a bit?

thanks

dj


Pegasus (MVP) said:
Try to walk before you run. In other words, before running
a ping command from within a batch file, run it from a command
prompt. This is how it works:
- Click Start / Run / cmd {OK}
- Type this command:
ping www.google.com

If you do not get a response then there is something wrong
with your network setup or with your Internet connection.
This has nothing at all to do with the batch file. Fix up your
Internet connection, then start working with the batch file!


rrjmd said:
thanks for your reply -- I copy pasted your bat file to notepad and "saveas"d
keepopen.bat. then I clicked on it which opened a new small window with a
black background and a header bar which read C:WINDOWS\system32\cmd.exe
[which is exactly what happened when I used my old batch file as well]. It
simply remained blank for about 30 sec then gave an error message: "the ping
request could not find host www.google.com. Please check the name and try
again." [Now this error message was new to me - my old bat file never even
got that far]

But: that's as far as it went. the curser returned and it just set there
processing no more instructions- I could not tell whether or not it actually
pinged or accessed the internet connection before it gave the error messages.

any more suggestions? thanks again in advance for your help.

BTW - I do back up files - the file that I referenced did work before I
restored my system/ not any more afterwards - that's the problem.




Pegasus (MVP) said:
I've used a simple .bat file to recycle through a ping command in order to
keep open my internet connection through my cell phone when I use it. It's
always worked well through the many upgrades from sp1 to sp2 etc.

Now, because HP said they couldn't create me a boot disk, I had to do a
complete fresh install using an OEM WinXPsp2 (and new codes from a call to
MS). But, now, I cannot get the batch file to work. The cmd.exe window
comes
up but no command lines are either shown or processed. I've tried
disabling
my zone alarm firewall and rewriting the bat file- all to no avail..

To me, it seems like there's a setting not set right - one that might have
not overwritten defaults the first time when upgrading; but, now which
doesn't get set correctly during a fresh install.

Can someone tell me how to get a .bat file to work in order to Ping -
using
WinXpxp2 ???

@echo off
:again
ping www.google.com
ping localhost -n 120 > nul
goto again

If this does not work then you need to tell us exactly what
happens when you run it.

BTW, unless you enjoy re-inventing the wheel, you should
back up all tools (such as this one) and programs/drivers
(such as those you download from the Internet).
 
P

Pegasus \(MVP\)

As I said before: Walk before you try to run!

If the ping command only works when IE is open then you
have a serious networking problem. Resolve it first, then
let's concentrate on the batch file.


rrjmd said:
more in the saga:

I don't know why the cmd.exe began working the ping - it hasn't done it
before.

FIRST: I took out the no-echo and saw the commands being processed. The ping
worked from within the bat file; but, it seems to ONLY work when I've got IE
window open. If I try to run the bat file- CONNECTED to the internet, BUT
WITHOUT IE open - it does NOT process the commands - it gives me the error
message that it couldn't find www.google.com, try again and stops. If I open
IE - the bat file doesn't restart itself. but if (with ie open) I restart the
bat file it starts pinging again.

This is NOT how it worked B4 I did the complete reinstall. Before, even if
I wasn't connected to the internet the batch file would still work but give
non-halting error messages then continue on looping through the bat file
commands. But, like i said before, I don't know what settings are different
now.

SECOND: I took out the line "ping localhost -n 120 > nul" and now the bat
file does cycle. However it seems like it's pinging way too often (does it
hog bandwitdth and actually slow my surfing?) What does this command line
actually do? Whatever it is it doesn't seem to let the file cycle back to
"again:" often enough to keep my sprint connection open. If I use the file
without the line - it does keep it open (like I need) but it seems - to me-
that it slows down my overall browsing.

SO: what does that line to? Is it essential? Does it give a clue to any
settings that I've got which are wrong? Is there an alternative to slow the
pinging down a bit?

thanks

dj


Pegasus (MVP) said:
Try to walk before you run. In other words, before running
a ping command from within a batch file, run it from a command
prompt. This is how it works:
- Click Start / Run / cmd {OK}
- Type this command:
ping www.google.com

If you do not get a response then there is something wrong
with your network setup or with your Internet connection.
This has nothing at all to do with the batch file. Fix up your
Internet connection, then start working with the batch file!


rrjmd said:
thanks for your reply -- I copy pasted your bat file to notepad and "saveas"d
keepopen.bat. then I clicked on it which opened a new small window with a
black background and a header bar which read C:WINDOWS\system32\cmd.exe
[which is exactly what happened when I used my old batch file as
well].
It
simply remained blank for about 30 sec then gave an error message:
"the
ping
request could not find host www.google.com. Please check the name and try
again." [Now this error message was new to me - my old bat file never even
got that far]

But: that's as far as it went. the curser returned and it just set there
processing no more instructions- I could not tell whether or not it actually
pinged or accessed the internet connection before it gave the error messages.

any more suggestions? thanks again in advance for your help.

BTW - I do back up files - the file that I referenced did work before I
restored my system/ not any more afterwards - that's the problem.




:


I've used a simple .bat file to recycle through a ping command in order to
keep open my internet connection through my cell phone when I use
it.
It's
always worked well through the many upgrades from sp1 to sp2 etc.

Now, because HP said they couldn't create me a boot disk, I had to
do
a
complete fresh install using an OEM WinXPsp2 (and new codes from a call to
MS). But, now, I cannot get the batch file to work. The cmd.exe window
comes
up but no command lines are either shown or processed. I've tried
disabling
my zone alarm firewall and rewriting the bat file- all to no avail..

To me, it seems like there's a setting not set right - one that
might
have
not overwritten defaults the first time when upgrading; but, now which
doesn't get set correctly during a fresh install.

Can someone tell me how to get a .bat file to work in order to Ping -
using
WinXpxp2 ???

@echo off
:again
ping www.google.com
ping localhost -n 120 > nul
goto again

If this does not work then you need to tell us exactly what
happens when you run it.

BTW, unless you enjoy re-inventing the wheel, you should
back up all tools (such as this one) and programs/drivers
(such as those you download from the Internet).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top