user3606575
user3606575

Reputation: 43

Can I enable/disable a network connection from the command-line or MS-Dos?

I want to enable/disable a network connection from the command-line in Windows 8.

netsh interface set interface “Local Area Connection” DISABLED 

To enable the interface, you'd then run:

netsh interface set interface “Local Area Connection” ENABLED 

When I try this, it generates an error message which states that "no more data is available".

Upvotes: 4

Views: 4351

Answers (3)

Sam Ginrich
Sam Ginrich

Reputation: 851

Technical Note: There are several names associated with a network adapter on Windows API level, occurring in Struct PIP_ADAPTER_ADDRESSES

PIP_ADAPTER_ADDRESSES::AdapterName
PIP_ADAPTER_ADDRESSES::Description
PIP_ADAPTER_ADDRESSES::FriendlyName

FriendlyName is a unique logical name like "WLAN 3", generated by the system and the one displayed with ipconfig and required in netsh interface ....

Description is the tag displayed with ipconfig /all

Upvotes: 0

foxidrive
foxidrive

Reputation: 41307

This may be enough for you if you are using DHCP.

Disable:

ipconfig /release *

Enable:

ipconfig /renew

Upvotes: 3

gammay
gammay

Reputation: 6215

This works for me:

netsh interface set interface name="Local Area Connection" admin=DISABLED

Upvotes: 2

Related Questions