Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

When I log into Windows 7 I need to wait 10 seconds and then disable the Local Area Connection (ethernet adaptor) and then reenable it.

I have looked through the suggested answer: Enable/disable wireless interface in a bat file but that seems irrelevant as it just toggles the current state.

From what I can tell I need to include:

netsh interface set interface "Local Area Connection" DISABLED
netsh interface set interface "Local Area Connection" ENABLED

but I'm unsure of the wait time or how I can have this start after Windows has successfully logged in.

What's the best approach here?

share|improve this question
Why do you need to wait 10 seconds, disable the LAN and then re-enable it? – That Brazilian Guy Dec 18 '12 at 1:51
Tell us the underlying problem, it may be more sensible to solve that than to mess with interface. – Paul Dec 18 '12 at 2:42
I use 2 x TL-PA211 EOP adaptors ( to connect to my home modem/router. The issue is that whenever I boot up my machine, my ethernet adaptor does not automatically connect, instead I see the following: - – it tells me that I am connected to my usual home network plus an Unidentified network. I then have to disable my ethernet adaptor and reenable it and then it connects to my usual home network - every time I turn the computer on. I am using the TL-PA2111 pairing application and my Ethernet drivers are up to date. – rlsaj Dec 18 '12 at 3:50
up vote 3 down vote accepted

Create a Windows Scheduled Task (taskschd.msc or Control Panel\System and Security\Administrative Tools\Task Scheduler) with a Trigger: begin the task At log on and in the Advanced settings delay task for 30 seconds. Then add an Action to Start a program and select your .bat script.

share|improve this answer
Perfect, thanks David. – rlsaj Dec 20 '12 at 21:16

I hope this helps

@echo on
timeout /t 10
netsh interface set interface "Local Area Connection" DISABLED
timeout /t 10
netsh interface set interface "Local Area Connection" ENABLED
share|improve this answer
Upvoted because it's just, what I was looking for, I needed a 2 sec delay between the on and off and no initial, for when sometimes my card refuses to get a connection on startup, so I have a handy bat file on the desktop – Limiter Aug 1 '14 at 16:24

The logic is: ping public ip (google dns, if the ping fails, then goto :RESTART and restart network adapter with name "LAN", after this loop again from the start (if ping is OK, then do nothing and ping in loop to check if adapter is connected to internet)

   @echo off 

    netsh interface set interface "LAN" disabled
    ping -n 3
    netsh interface set interface "LAN" enabled
    ping -n 15
    goto LOOP
share|improve this answer
Like the logic you put in for looping! – Colin Aug 30 '15 at 18:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.