Enable/disable network connection from command line

trante picture trante · Nov 7, 2013 · Viewed 93.8k times · Source

I know that there exists ton of results in Google for this: results, but I didn't make it in my Windows XP machine. I want to disable LAN connection from command line.

>netsh interface set interface "Local Area Connection" DISABLED
One or more essential parameters not specified
The syntax supplied for this command is not valid. Check help for the correct sy
ntax.

>netsh interface set interface name="Local Area Connection" admin="disabled"
One or more essential parameters not specified
The syntax supplied for this command is not valid. Check help for the correct sy
ntax.

>netsh interface set interface name="Local Area Connection" admin=DISABLED
One or more essential parameters not specified
The syntax supplied for this command is not valid. Check help for the correct sy
ntax.

Answer

Yarish Kumar picture Yarish Kumar · Sep 23, 2014

For the first two commands, you need elevated/ administrator rights:

Disable the LAN network connection

C:\> netsh interface set interface name="Local Area Connection" admin=disabled

Enable the LAN network connection

C:\> netsh interface set interface name="Local Area Connection" admin=enabled

assumption : your interface was named as "Local Area Connection" else substitute proper name. Use netsh interface show interface to find the name.

List Wifi profiles

C:\> netsh wlan show profiles

Connect to Wifi profile

C:\> netsh wlan connect name="ProfileName"