wait4net.bat -- Wait for internet connection
--- Freeware ---
[page last modified 2007-10-15]

Wait4net.bat is a batch file to wait for a network connection, then optionally launch a specified program. I use it on computers that may not have a network connection right at boot time; for instance, a computer that is plugged into a power strip shared with a router or cable/DSL modem. In such cases the network connection may be a few seconds away from being active as the computer is booting. Wait4net.bat will delay until the network is live, then run a program that relies on the network.

Here's an example of how wait4net.bat might be used.
  step (1) create a shortcut on the desktop
  step (2) in the 'Target:' field put
    wait4net.bat start "c:\Program Files\Outlook Express\msimn.exe"
  step (3) in the 'Run:' field select "Minimized"

That's it! The above example waits for the network connection to be live and then launches Outlook Express. You may drag the shortcut you have just created into the Windows startup folder to have this happen at boot time.

You may accumulate a log of the results of each time you run wait4net by inserting "/log filename" after "start" in the wait4net command line. In the above example, the 'Target:' field might change to
    wait4net.bat start /log c:\wait4res.txt
      "c:\Program Files\Outlook Express\msimn.exe"

If you have multiple programs to start create a second .bat file that launches each of them, one at a time. Then use the name of this second .bat file on the wait4net.bat 'Target:' line, following "start".

Wait4net.bat does not use any of the Windows XP command extensions and therefore runs on Windows 98 as well as XP (most probably on 95 and Vista as well -- please test it and let me know).

The definition of a live network connection, as far as wait4net.bat is concerned, is getting successful ping results from any of a number of popular websites. The only external commands wait4net uses are PING and FIND.

Click here to download  wait4net.bat

You are visitor 35394       Go to Home Page