问题
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.
回答1:
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"
回答2:
You have to run it with elevated/ admin privileges.
(On Windows 7, I otherwise get the confusing error message
An interface with this name is not registered with the router.
)
(I edited @yarish kumar's answer to reflect this.)
回答3:
okay it looks like you need to delete the profile from the table. I.E.
netsh LAN>delete "profile of LAN connection"
before this you should save the configuration info of the LAN in case you want to ADD it back it will save as an XML file then to add it back just do
netsh LAN>ADD file-name="profile1.XML" interface="Local Area Connection"
also look at http://www.computerhope.com/netsh.htm for more details about netsh commands
Hope this helps
回答4:
C:\WINDOWS\system32>netsh interface show interface
Admin State State Type Interface Name
Enabled Connected Dedicated Ethernet 2 Enabled Disconnected Dedicated Ethernet Enabled Connected Dedicated Wi-Fi
C:\WINDOWS\system32>netsh interface set interface name="Ethernet" admin=enable or disable
w10 output this..
来源:https://stackoverflow.com/questions/19831023/enable-disable-network-connection-from-command-line