How do I disable a wired network interface using Windows batch scripting?

2

How do I disable a wired network interface using Windows batch scripting?

What commands do I need to use?

Nick

Posted 2011-05-16T22:26:59.240

Reputation:

My research indicates that this is not possible just using a batch file, you would need to use .NET code to talk to WMI or the Windows Script Host.

The following two articles should help get you started:

http://www.codeproject.com/KB/system/cstcpipwmi.aspx?df=100&forumid=30597&exp=0&select=1564462

http://mcpmag.com/articles/2003/11/01/controlling-network-connections.aspx

– None – 2011-05-16T22:42:55.060

Hi @Nick, welcome to Stack Overflow; you've just found out that our FAQ states, "the best Stack Overflow questions have a bit of source code in them". :) Perhaps you've confused Stack Overflow with http://www.topcoder.com/ ? Stack Overflow is a repository of high-quality questions and answers. Had you posted the code you've already tried, and asked for help, you probably would have gotten better results. (Of course, @DaveRead's links look very helpful.) You might also like to read http://tinyurl.com/so-hints for more advice on what we like to see in questions.

– sarnold – 2011-05-16T22:57:02.350

uhm, which version of windows are you using? – yeedl – 2011-05-24T02:41:41.923

Answers

1

To disable an interface in Windows type in the console :

netsh interface set interface "My Interface Name " DISABLE

and to enable it :

netsh interface set interface "My Interface Name " ENABLE

Quentin

Posted 2011-05-16T22:26:59.240

Reputation: 156