Posted in Windows
stop and start network adapters in a batch file or DOS using netsh
Sometimes you may want to stop and start network adapters from a command line. This is especially true for when you want to use them in a DOS batch file.
To do this we are going to use Net Shell (netsh) which is a powerful command line based tool for managing network properties. net shells capabilities extend far beyond what we are doing here and i encourage you to investigate this further. To get a list of commands try typing ” netsh /? ” at a command line
Firstly you will want to find the name of the adapter. to do this, open Network and Sharing Center (in Win 7 and Vista) and choose Change adapter settings. Typically, the a LAN connection is named ” Local Area Connection ” and a wireless connection is named ” Wireless Network Connection ” . This can also be discerned from looking at an ipconfig read out, where for a LAN connection is will say Ethernet Adapter Local Area Connection ” . if doing this remember to drop the Ethernet adapter portion of the name.
Another way to find the name is to open a DOS command and enter netsh interface show interface. The name listed in the interface name is the name of the connection. In this case was are focusing on the Wireless Network Connection
For this example we will use a wireless network adapter with the default name of “Wireless Network Connection”
The command to disable this connection is:
netsh interface set interface “Wireless Network Connection” DISABLE
to enable the adapter again, the command is:
netsh interface set interface “Wireless Network Connection” ENABLE
as you can see, this would be really easy to put in a batch file to put in a start up or deploy in other methods.
for a video tutorial on this, please check the youtube video below:
This post can also be located at our sister site inkytek.com at: http://inkytek.blogspot.com.au/2012/03/stop-and-start-network-adapters-in.html