# Disabling a NIC using Batch file commands



## easystreet (Apr 14, 2004)

I have a Win2K system with 2 NICs in it. I can go to MyNetworkPlaces>Properties and right-click on one of the NICs and select Disable.

Does anyone know how to duplicate these actions via one or more Batch File commands?


----------



## Geoffp (May 11, 2004)

Excellent question. I was curious myself as I've never heard of a way to do it, I figured netsh would have something, but nothing worked, so I snooped around a bit more and found a usenet post suggesting the use of a utility from MS "devcon.exe"

You can download the devcon utility here:

http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q311272

Since I've never used it before, there may be an easier way, you'll need to play with the program a little, but here's how I was able to disable and enable my network connection:

devcon hwids * > out.txt

The above command outputs a list of all hardware ID's for devices on the local computer. It was quite a long list on my computer which is why I redirected the output to out.txt. Inside out.txt I searched for a my ethernet cards entry.

PCI\VEN_1317&DEV_0985&SUBSYS_05741317&REV_11\3&61AAA01&0&58 
Name: Linksys LNE100TX Fast Ethernet Adapter (LNE100TX v4)
Hardware ID's:
PCI\VEN_1317&DEV_0985&SUBSYS_05741317&REV_11
PCI\VEN_1317&DEV_0985&SUBSYS_05741317
etc. etc. a bunch of other mumbo jumbo

The Hardware ID was just the first bit before the &. "PCI\VEN_1317"

Then from the command prompt I was able to disable the network connection with this command:

devcon disable PCI\VEN_1317



-Geoffp


----------



## easystreet (Apr 14, 2004)

Thanks for the info - will give it a try.


----------

