![]() |
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-09-13 22:20 |
47,812 topics / 349,916 posts / today 0 new / 48,268 members |
| DOS批处理 & 脚本技术(批处理室) » [Resolved and Updated] Disable the local area connection network card in batch and then re-enable the connection |
| Printable Version 11,584 / 15 |
| Floor1 flying008 | Posted 2006-07-18 12:22 |
| 中级用户 Posts 103 Credits 245 | |
|
Asking all you experts:
I want to disable the local connection in the batch script and then enable it immediately, (that is, the process of right-clicking the "Local Connection" icon in the system tray on the Windows interface and selecting "Disable", then right-clicking "Network Neighborhood" and selecting "Local Connection" and clicking it to select "Enable"). But which command can achieve such a function? I found netsh, but the syntax still can't be implemented... I hope someone can give me a pointer... =========== @echo off netsh interface set interface "Local Area Connection" "disabled" netsh interface set interface "Local Area Connection" "enabled" exit ============= :( [ Last edited by flying008 on 2006-7-22 at 08:07 ] |
|
| Floor2 flying008 | Posted 2006-07-20 09:10 |
| 中级用户 Posts 103 Credits 245 | |
|
I searched a lot of similar posts online, and the answers were nothing but the above commands. But actually, NETSH can't solve this problem; otherwise, there wouldn't be DEVCON. After spending N hours of exploration , I finally solved this problem. However, I still need to rely on a small thing developed by Microsoft, DEVCON. I will write out the detailed process and usage later, to be continued...
If you run the devcon help command, a list of commands and description information will appear. The devcon help command can provide detailed help about any command. Using some of these commands, you can specify a remote target computer. [ Last edited by flying008 on 2006-7-21 at 13:52 ] |
|
| Floor3 darkradx | Posted 2006-07-20 13:14 |
| 高级用户 Posts 420 Credits 972 | |
|
Hurry up
netsh is really not easy to use, picking the name of the network connection, not universal |
|
| Floor4 flying008 | Posted 2006-07-21 13:42 |
| 中级用户 Posts 103 Credits 245 | |
|
Here comes……
Preface: Because I need to disable and enable the network card under batch processing, I specially found a lot of 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. DevCon can be used for Microsoft Windows 2000, Windows XP, and Windows Server 2003, but it cannot be used for Windows 95, Windows 98, or Windows Millennium Edition. General usage: (Introduce several common commands and grammars) 1. devcon find devcon find * devcon find pci\* 2. devcon disable *msloop 3. devcon enable '*MSLOOP 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 am going to disable the network card, please see carefully: devcon disable *DEV_8139* I am 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 messages. Other things will not be said much. If you like to use it, go and download a compressed package to use on your own computer. Some people may think that if it has more powerful functions, please rely on 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. Download address: http://download.microsoft.com/download/1/1/f/11f7dd10-272d-4cd2-896f-9ce67f3e0240/devcon.exe [ Last edited by flying008 on 2006-7-21 at 13:49 ] |
|
| Floor5 mylovelyqq | Posted 2006-11-30 07:40 |
| 初级用户 Posts 25 Credits 170 | |
|
Thanks a lot, flying008
|
|
| Floor6 tianzizhi | Posted 2006-11-30 08:03 |
| 高级用户 Posts 214 Credits 623 | |
|
netsh interface set interface "Local Area Connection" "disabled"确实可以 use, I have used it, and it succeeds every time.
Among them, "Local Area Connection" is the name of the connected connection in the Control Panel - Network Connections. If you have changed the name, or it is not the network on the default Local Area Connection but the network on the connection you created yourself, it will not work. You need to change the word "Local Area Connection" to the name of the connection you are using. |
|
| Floor7 electronixtar | Posted 2006-11-30 10:24 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
That's because your batch processing is not good. Can you get the connection name by reading the registry? |
|
| Floor8 a9319751 | Posted 2006-12-09 04:52 |
| 中级用户 Posts 170 Credits 439 | |
|
```batch
for /f "usebackq tokens=3 delims= " %%i in (`netsh interface show interface^|find "专用"`) do ( set a=%%i if #%%i neq #本地连接 netsh interface set interface name=%%i newname=本地连接 ) pause ``` Modify the name of the local connection |
|
| Floor9 rainbow | Posted 2007-03-17 04:50 |
| 新手上路 Posts 3 Credits 6 | |
|
Strongly protest!!!!!
That thing doesn't work!!!!! PCI\VEN_1022&DEV_1100&SUBSYS_00000000&REV_00\3&267A616A&0&C0: PCI standard host CPU bridge PCI\VEN_1022&DEV_1101&SUBSYS_00000000&REV_00\3&267A616A&0&C1: PCI standard host CPU bridge PCI\VEN_1022&DEV_1102&SUBSYS_00000000&REV_00\3&267A616A&0&C2: PCI standard host CPU bridge PCI\VEN_1022&DEV_1103&SUBSYS_00000000&REV_00\3&267A616A&0&C3: PCI standard host CPU bridge PCI\VEN_10DE&DEV_0242&SUBSYS_02421849&REV_A2\3&267A616A&0&28: NVIDIA GeForce 610 0 PCI\VEN_10DE&DEV_0261&SUBSYS_00000000&REV_A2\3&267A616A&0&50: PCI standard ISA b ridge PCI\VEN_10DE&DEV_0264&SUBSYS_02641849&REV_A2\3&267A616A&0&51: NVIDIA nForce PCI System Management PCI\VEN_10DE&DEV_0265&SUBSYS_02651849&REV_A1\3&267A616A&0&68: PCI\VEN_10DE&DEV_0 269&SUBSYS_02691849&REV_A1\3&267A616A&0&A0: NVIDIA Network Bus Enumerator PCI\VEN_10DE&DEV_026B&SUBSYS_08501849&REV_A2\3&267A616A&0&82: Realtek AC'97 Audi o PCI\VEN_10DE&DEV_026D&SUBSYS_026D1849&REV_A2\3&267A616A&0&58: Standard OpenHCD U SB Host Controller PCI\VEN_10DE&DEV_026E&SUBSYS_026E1849&REV_A2\3&267A616A&0&59: Standard Enhanced PCI to USB Host Controller PCI\VEN_10DE&DEV_026F&SUBSYS_00000000&REV_A2\3&267A616A&0&80: PCI standard PCI-t o-PCI bridge PCI\VEN_10DE&DEV_0270&SUBSYS_02701849&REV_A2\3&267A616A&0&48: nForce Memory Cont roller PCI\VEN_10DE&DEV_027E&SUBSYS_027E1849&REV_A2\3&267A616A&0&07: nForce Memory Cont roller PCI\VEN_10DE&DEV_027F&SUBSYS_027F1849&REV_A2\3&267A616A&0&06: nForce Memory Cont roller PCI\VEN_10DE&DEV_02F1&SUBSYS_02F11849&REV_A2\3&267A616A&0&00: PCI standard RAM C ontroller PCI\VEN_10DE&DEV_02F8&SUBSYS_02F81849&REV_A2\3&267A616A&0&03: nForce Memory Cont roller PCI\VEN_10DE&DEV_02F9&SUBSYS_02F91849&REV_A2\3&267A616A&0&04: nForce Memory Cont roller PCI\VEN_10DE&DEV_02FB&SUBSYS_00000000&REV_A1\3&267A616A&0&20: PCI standard PCI-t o-PCI bridge PCI\VEN_10DE&DEV_02FC&SUBSYS_00000000&REV_A1\3&267A616A&0&10: PCI standard PCI-t o-PCI bridge PCI\VEN_10DE&DEV_02FD&SUBSYS_00000000&REV_A1\3&267A616A&0&18: PCI standard PCI-t o-PCI bridge PCI\VEN_10DE&DEV_02FE&SUBSYS_02FE1849&REV_A2\3&267A616A&0&02: nForce Memory Cont roller PCI\VEN_10DE&DEV_02FF&SUBSYS_02FF1849&REV_A2\3&267A616A&0&05: nForce Memory Cont roller 24 matching device(s) found. Who can tell me which one is the network card |
|
| Floor10 heicai | Posted 2007-03-17 05:13 |
| 中级用户 Posts 156 Credits 385 | |
Originally posted by electronixtar at 2006-11-29 09:24 PM: Can you explain how to read the registry? |
|
| Floor11 heicai | Posted 2007-03-17 06:08 |
| 中级用户 Posts 156 Credits 385 | |
|
The landlord can try this command to see if it meets your requirements
rasphone -h VPN Can disconnect the VPN dial-up connection |
|
| Floor12 everest79 | Posted 2007-03-17 15:42 |
| 金牌会员 Posts 1,127 Credits 2,564 | |
|
The command of the landlord can close the public network interface WAN, but cannot be used to close the private network interface LAN. Because the private network interface is managed locally by default whether it is disabled or not, so the admin state will not have any effect at all
|
|
| Floor13 bnxf | Posted 2007-03-25 04:29 |
| 初级用户 Posts 16 Credits 29 | |
|
The method introduced by flying008 I just verified, it's very effective, thank you for the guidance.
|
|
| Floor14 ngd | Posted 2007-11-10 14:24 |
| 中级用户 Posts 108 Credits 312 | |
|
netsh interface set interface "Local Area Connection" "disabled"
netsh interface set interface "Local Area Connection" "enabled" Only for non-LAN |
|
| Floor15 wjcing | Posted 2007-12-28 14:41 |
| 初级用户 Posts 59 Credits 71 | |
|
It's quite useful.. just need to find the network card... I wonder if there's any way to find the network card...
|
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |