Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Detect Lan Connection

Aug
1,933
71
No computer connected to the Internet, or any other TCP/IP compliant network, can identify itself as 127.0.0.1

Thus;

echo %@if[%_ip eq 127.0.0.1,0,1]

function IsLan=`%@if[%_ip eq 127.0.0.1,0,1]`

echo %@IsLan[]

If @IsLan[] returns a 0, then you have no Lan connection.

If @IsLan[] returns a 1, then you have a Lan connection.

You can test this by issuing the IPCONFIG /release command to release the IP address for your adapter, and the IPCONFIG /renew command to renew the IP address for your adapter. (tested on XP).

Joe
 
Back
Top