script to disable / enable network interface

I have PC with windows 8.1 OS. It is required to

disable network adapter through command line.

The Ethernet adapter is described as 

"Ethernet adapter Ethernet" when 

seen in ipconfig / all command.

Please give a suitable batch file

to disable / enable ethernet interface.

thanks

hsg

Answer
Answer

Hello HSG,

Thank you for posting your query in Microsoft Community.

Apart from modifying network adapter properties from the Control Panel, you can also use the Command line tool to enable disable Network Interface Card.

  1. Press Windows key + X, click Command Prompt (Admin).
     
  2. In the elevated command prompt, copy and paste the command below, and press Enter. This will show you all network adapter names on your PC.
    netsh interface show interface
     
  3. To enable NIC type, the following command:
    netsh interface set interface "network_adapter_name" admin=enable
    (e.g netsh interface set interface "MyEthernet" admin=enable)
     
  4. To disable NIC type, the following command:
    netsh interface set interface "network_adapter_name" admin=disable
    (e.g netsh interface set interface "MyEthernet" admin=disable)
     
  5. Close the command prompt.

Hope this information is helpful. Do let us know if you need any further assistance, we'll be glad to assist you.

Regards,

Harkanwar

265 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated April 23, 2024 Views 146,981 Applies to: