中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-04 13:21
48,038 topics / 350,123 posts / today 0 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » Can commands be used to enable or disable the network card?
Printable Version  1,992 / 8
Floor1 zerostudy Posted 2006-11-25 01:53
中级用户 Posts 98 Credits 266
In 2003, what commands are available under DOS?
Floor2 zerostudy Posted 2006-11-25 01:56
中级用户 Posts 98 Credits 266
netsh interface set interface "Local Area Connection" admin=ENABLED Is that so? What's the format?



Last edited by zerostudy on 2006-11-25 at 02:05 AM ]
Floor3 ccwan Posted 2006-11-25 02:19
金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊
Brother's code doesn't seem to disable the "network card"
Floor4 ddyou Posted 2007-03-26 03:16
新手上路 Posts 5 Credits 14
Here comes...
Preface: Because I need to disable and enable the network card under batch processing, so I specially found many such posts. There are also many people on the Internet who write statements like netsh interface set interface "Local Area Connection" "disabled" to say that it can be disabled, but in fact ------- using netsh cannot successfully disable the network card. At least I have tried for N hours and it is not successful. Fortunately, I found ------- devcon.exe, this small thing developed by Microsoft. Although it is not very intelligent, it solves the problem to a certain extent. Now let's talk about the outline of it:
The DevCon utility is a command-line utility that can replace Device Manager. With DevCon, you can enable, disable, restart, update, delete, and query a single device or a group of devices. DevCon also provides information related to driver developers that cannot be seen in Device Manager.

You can use DevCon for Microsoft Windows 2000, Windows XP, and Windows Server 2003, but not for Windows 95, Windows 98, or Windows Millennium Edition.
General usage: (Introduce several common commands and syntax)
1. devcon find
devcon find * [This command can list all device instances of the devices existing on the local computer]
devcon find pci\* [List all known "Peripheral Component Interconnect" (PCI) devices on the local computer (if a device's hardware ID starts with "PCI\" as a prefix, this command considers the device as a PCI device]
2. devcon disable *msloop [Disable all devices whose hardware ID ends with "MSLOOP" (including "*MSLOOP")]
3. devcon enable '*MSLOOP
[Enable all devices whose hardware ID is "*MSLOOP". The single quote indicates that the hardware ID must be strictly interpreted literally (in other words, the asterisk ["*"] is really an asterisk, not a wildcard]
4. devcon remove @usb\*
Delete all USB devices. The deleted devices will display their deletion status when listed

Because an example will be talked about below, so first talk about what the hardware ID is. To be honest, it is to let everyone know how to find it. Please see:
find pci\* The following is part of what is found:
PCI\VEN_10EC&DEV_8139&SUBSYS_813910EC&REV_10\3&13C0B0C5&0&58: Realtek RTL8139 Family PCI Fast Ethernet NIC
PCI\VEN_1106&DEV_0571&SUBSYS_18271019&REV_06\3&13C0B0C5&0&89: VIA Bus Master IDE Controller
PCI\VEN_1106&DEV_3038&SUBSYS_18271019&REV_80\3&13C0B0C5&0&80: VIA Rev 5 or later USB Universal Host Controller
The part before ":" in these lines is the hardware ID, and the part after is the device name.
I'm going to disable the network card. Please see carefully:
devcon disable *DEV_8139* [That's it, provided that you have devcon.exe on your computer]
I'm going to enable it, do the same: devcon enable *DEV_8139*
If you specify -r and need to restart, then after processing all devices, it will restart without any warning information. I won't say more about the others. If everyone likes to use it, just download a compressed package and use it on your own computer. Some people may think that if it has more powerful functions, please help yourself... Believe in yourself!
There are 2 folders in the compressed package, one for 32-bit use and one for 64-bit use,
The DevCon.exe file contains the following files:
File Description
I386\DevCon.exe Binary file of the 32-bit DevCon tool. This file does not function fully on 64-bit Windows.
Ia64\DevCon.exe Binary file of the 64-bit DevCon tool.
Floor5 snow2000 Posted 2007-03-26 09:25
新手上路 Posts 4 Credits 8 From 四川
DevCon combined with scripts can achieve the functions you need. Study DevCon carefully and you can write scripts.
Floor6 kingstry Posted 2007-03-29 09:30
新手上路 Posts 6 Credits 12
DevCon combined with scripts can achieve the functions you need. Study DevCon carefully and you can write scripts.
I have also been searching for a long time. Besides devcon, I really haven't found other better command modes to disable the network card.
Floor7 zts59 Posted 2007-03-29 10:04
中级用户 Posts 104 Credits 387
DEVCON also has limitations. How to determine the hardware ID of a network card without knowing the hardware ID of the network card?
Floor8 flying008 Posted 2007-04-27 01:58
中级用户 Posts 103 Credits 245
Floor9 qq43142691 Posted 2007-05-04 10:01
中级用户 Posts 152 Credits 326
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023