I have found 2 different examples but neither of them seem to work. It
seems that regaurdless if the computer is connected to the internet or
not it always comes back and not connected. The error level is always
1.
Here is one of the examples
@ECHO OFF
ECHO Checking connection, please wait...
PING 194.109.6.66 Ś FIND "Reply from " > NUL
IF NOT ERRORLEVEL 1 ECHO You have an active connection to the internet
IF ERRORLEVEL 1 ECHO You have NO active connection to the internet
What needs to be changed so that this will correctly report if the
connection can be established?
Thanks for you help with this.
> I am working on winxp, trying to write a batchfile for 9x,nt,2k,and
> xp. I want to be able to check for a connection to the inter
>
> I have found 2 different examples but neither of them seem to work. It
> seems that regaurdless if the computer is connected to the internet or
> not it always comes back and not connected. The error level is always
> 1.
Try this, copy and paste it, as your version had an invalid pipe character
"|".
@ECHO OFF
ECHO Checking connection, please wait...
PING www.playboy.com | FIND /i "TTL">NUL
IF NOT ERRORLEVEL 1 ECHO Yahoo! www.playboy.com is online!
IF ERRORLEVEL 1 ECHO Doh! We can't reach www.playboy.com
You are using the wrong character !
Use | instead of Ś
--
Marco
> I am working on winxp, trying to write a batchfile for 9x,nt,2k,and
> xp. I want to be able to check for a connection to the inter
>
> I have found 2 different examples but neither of them seem to work. It
> seems that regaurdless if the computer is connected to the internet or
> not it always comes back and not connected. The error level is always
> 1.
>
> Here is one of the examples
>
> @ECHO OFF
> ECHO Checking connection, please wait...
> PING 194.109.6.66 Ś FIND "Reply from " > NUL
PING is not ideal for checking connections,
use rasdial in XP.
If you want a continuous checking
use the following:
@echo off
:loop
set a=1
FOR /F "skip=2" %%i IN ('rasdial') DO set a=%%i
if %a%==1 goto :sub
goto :loop
:sub
set /p=You have no active connections
--
Marco
Thank you that worked great.
Now if I could only fix this other error
Error www.play.com Blocked by Websence....
>Now if I could only fix this other error
>
>Error www.play.com Blocked by Websence....
Use the name or IP address of one of your ISP's servers - it only has
to be a machine somewhere on Internet and the closer it is to your
ISP, the less intrusive it is.
T.E.D. (tda...@gearbox.maem.umr.edu - e-mail must contain "T.E.D." or my .sig in the body)
I found this to work well.
@ECHO OFF
ECHO Checking connection, please wait...
PING www.internic.com | FIND /I "Reply from " >NUL
IF NOT ERRORLEVEL 1 GOTO FAIL
ECHO You have NO active connection to the internet
GOTO END
:FAIL
ECHO You have an active connection to the internet
:END
Cameron
http://cameronstevens.netfirms.com
"Mike" <mjgr...@lycos.com> wrote in message
news:674e7365.04012...@posting.google.com...
Yes. On the side of the actual subject of the syntax, if I
understand correctly that one tells us about having the address
available on the connection's name server. If one wishes to check if
the site is reachable, then one can start with the IP number, which
in that particular case is 192.0.34.161 I guess. But that comment of
mine is actually already slightly outside the script aspect of the
task.
All the best, Timo
--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland
Useful script files and tricks ftp://garbo.uwasa.fi/pc/link/tscmd.zip