Take the 2-minute tour ×

I suspect that there is a problem somewhere in my Dell Precision laptop, running XP Pro, that causes the wireless internet connection to be lost after about a half-hour of connection time. The wireless router is fine, as another laptop runs without problems.

To restore my connection, I can right click on the toolbar's wireless icon, and choose repair. However, sometimes this fails to resolve the problem, so I now open "Network Connections" right click on the wireless connection and select "disable". And then right click again and choose "enable". This always seems to work.

I would like to automate this process so that running a program/script/etc. on my desktop would take those actions for me. It is tiresome clicking through the same steps over and over. (Given that solution, I'd probably write a program to check the connection every two minutes and automatically call repair when needed.)

Is there some way to do the disable/enable steps from a script/program/etc. ?

I program in C#, but have been unable to find commands to do this.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

There's a related question on SO for this, which points to ToggleNIC here. The last one provides a link where you can download v1.0 which works for Windows XP.

From the included readme.txt file:

ToggleNic is a command line applications used to easily enable or disable a network connection.

Usage: ToggleNic [connection_name] [enable|disable]

If you do not specify enable or disable, the network connection will be toggled (enabled if it is disabled, or disabled if it is enabled). If you specify enable or disable, no change is made if the connection is already in the desired state.


ToggleNic "Local Area Connection"

ToggleNic "Local Area Connection 2" enable

ToggleNic "Wireless Connection" disable

share|improve this answer
Ah, what a relief. Works perfectly. Thanks! –  Mark T Sep 13 '10 at 16:12

Does just releasing and renewing the IP address work? You could make a pretty simple batch file to do that.

@echo off
ipconfig -release
ipconfig -renew
share|improve this answer

Your Answer


