China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-04 12:11
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Can commands be used to enable or disable the network card? View 1,991 Replies 8
Original Poster Posted 2006-11-25 01:53 ·  中国 广东 河源 电信
中级用户
★★
Credits 266
Posts 98
Joined 2006-04-21 20:29
20-year member
UID 54223
Gender Male
Status Offline
In 2003, what commands are available under DOS?
纵是千年万年 亦难以忘记
Floor 2 Posted 2006-11-25 01:56 ·  中国 广东 河源 电信
中级用户
★★
Credits 266
Posts 98
Joined 2006-04-21 20:29
20-year member
UID 54223
Gender Male
Status Offline
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 ]
纵是千年万年 亦难以忘记
Floor 3 Posted 2006-11-25 02:19 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
Brother's code doesn't seem to disable the "network card"
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 4 Posted 2007-03-26 03:16 ·  中国 云南 昆明 西山区 电信
新手上路
Credits 14
Posts 5
Joined 2006-12-09 16:13
19-year member
UID 73053
Gender Male
Status Offline
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.
Floor 5 Posted 2007-03-26 09:25 ·  中国 四川 自贡 联通
新手上路
Credits 8
Posts 4
Joined 2006-03-09 21:12
20-year member
UID 51677
Gender Male
From 四川
Status Offline
DevCon combined with scripts can achieve the functions you need. Study DevCon carefully and you can write scripts.
Floor 6 Posted 2007-03-29 09:30 ·  中国 上海 闵行区 电信
新手上路
Credits 12
Posts 6
Joined 2007-03-14 02:41
19-year member
UID 81650
Gender Male
Status Offline
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.
Floor 7 Posted 2007-03-29 10:04 ·  中国 广东 东莞 电信
中级用户
★★
Credits 387
Posts 104
Joined 2004-11-19 00:00
21-year member
UID 33813
Gender Male
Status Offline
DEVCON also has limitations. How to determine the hardware ID of a network card without knowing the hardware ID of the network card?
Floor 8 Posted 2007-04-27 01:58 ·  中国 湖北 武汉 联通
中级用户
★★
Credits 245
Posts 103
Joined 2006-06-30 00:00
20-year member
UID 57801
Gender Male
Status Offline
Floor 9 Posted 2007-05-04 10:01 ·  中国 广东 广州 黄埔区 电信
中级用户
★★
Credits 326
Posts 152
Joined 2007-05-04 06:16
19-year member
UID 87412
Gender Male
Status Offline
Forum Jump: