Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to automatically pass the firewall whenever the network connected (WIFI and LAN), I have a bat file to do this, but every time I need to run it manually, so is there a way to run this bat file whenever network available? Expect that there is a event listener for network status that I can hook to run the bat file. Or scheduled tasks can do this job?


share|improve this question

migrated from Dec 20 '12 at 8:57

This question came from our site for professional and enthusiast programmers.

A simple way of doing this would be to ping the lan until it becomes available

ping 192.168.x.x | find "Reply" >nul
if %errorlevel%==0 start yourbatchfile && exit /b >nul
timeout /t 5
goto :LOOP
share|improve this answer
Thanks, that could be a solution of monitor it all the time, I'm trying to find a way of listener to solve this problem. – JerryCai Dec 17 '12 at 5:14

You must log in to answer this question.