PC Review
Forums
Newsgroups
Windows 2000
Microsoft Windows 2000 Networking
The simple way to disable/enable LAN from command prompt, with a batch file, using devcon.exe
Forums
Newsgroups
Windows 2000
Microsoft Windows 2000 Networking
The simple way to disable/enable LAN from command prompt, with a batch file, using devcon.exe
![]() |
The simple way to disable/enable LAN from command prompt, with a batch file, using devcon.exe |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
1.Download Devcon.exe from Microsoft:
http://download.microsoft.com/downl...0240/devcon.exe 2. Create a batch file with the following single line: devcon disable "pci\ven_8086&dev_27dc" (don't forget quotation marks). That's all. Enable with: devcon enable "pci\ven_8086&dev_27dc" |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Unfortunately, this tip will only work for folks who have the same network
adapter that you do. -- Richard G. Harper [MVP Shell/User] rgharper@gmail.com * PLEASE post all messages and replies in the newsgroups * for the benefit of all. Private mail is usually not replied to. * My website, such as it is ... http://rgharper.mvps.org/ * HELP us help YOU ... http://www.dts-l.org/goodpost.htm <setup21@gmx.de> wrote in message news:1145153536.869771.75670@i39g2000cwa.googlegroups.com... > 1.Download Devcon.exe from Microsoft: > > http://download.microsoft.com/downl...0240/devcon.exe > > 2. Create a batch file with the following single line: > > devcon disable "pci\ven_8086&dev_27dc" > > (don't forget quotation marks). > > That's all. > > Enable with: > devcon enable "pci\ven_8086&dev_27dc" > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
The problem can be overcome by giving the command
some intelligence, namely by specifying the network adapter's name, as it appears in the Control Panel (verbatim!) in this batch file: Device.bat ======= @echo off goto Start --------------------------------------------------- Use this batch file to enable or disable a device from the Command Prompt. 16.4.2006 FNL --------------------------------------------------- :Start setlocal enabledelayedexpansion set Adapter=Broadcom NetXtreme Fast Ethernet if /i "%1"=="enable" goto go if /i "%1"=="disable" goto go echo Syntax: Device enable / disable goto :eof :go set HWID=x set count=0 set found=no devcon hwids "PCI\*" > device.txt for /F "tokens=*" %%* in (device.txt) do ( set /a count=!count! + 1 if /i "%%*"=="Name: %Adapter%" set found=yes& set count=1 if !found!==yes if !count!==3 set HWID=%%* ) if %found%==yes ( echo HWID=!HWID! devcon %1 "!HWID!" ) else ( echo Device "%Adapter%" not found. ) endlocal del device.txt "Richard G. Harper" <rgharper@email.com> wrote in message news:%237VIr7TYGHA.3972@TK2MSFTNGP04.phx.gbl... > Unfortunately, this tip will only work for folks who have the same network > adapter that you do. > > -- > Richard G. Harper [MVP Shell/User] rgharper@gmail.com > * PLEASE post all messages and replies in the newsgroups > * for the benefit of all. Private mail is usually not replied to. > * My website, such as it is ... http://rgharper.mvps.org/ > * HELP us help YOU ... http://www.dts-l.org/goodpost.htm > > > <setup21@gmx.de> wrote in message > news:1145153536.869771.75670@i39g2000cwa.googlegroups.com... > > 1.Download Devcon.exe from Microsoft: > > > > http://download.microsoft.com/downl...0240/devcon.exe > > > > 2. Create a batch file with the following single line: > > > > devcon disable "pci\ven_8086&dev_27dc" > > > > (don't forget quotation marks). > > > > That's all. > > > > Enable with: > > devcon enable "pci\ven_8086&dev_27dc" > > > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
You could give it even more intelligence by using WMI calls to enumerate the
various network adapters present and tossing out the known entries that aren't physical connections - but by that time I can right-click the network status icon I put down by the clock and disable and re-enable it. :-) -- Richard G. Harper [MVP Shell/User] rgharper@gmail.com * PLEASE post all messages and replies in the newsgroups * for the benefit of all. Private mail is usually not replied to. * My website, such as it is ... http://rgharper.mvps.org/ * HELP us help YOU ... http://www.dts-l.org/goodpost.htm "Pegasus (MVP)" <I.can@fly.com> wrote in message news:eXBwrxUYGHA.3684@TK2MSFTNGP05.phx.gbl... > The problem can be overcome by giving the command > some intelligence, namely by specifying the network adapter's > name, as it appears in the Control Panel (verbatim!) in this > batch file: |
|
|
|
#5 |
|
Junior Member
|
download devcon form Microsoft
1. Find the registry key for your adapter [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\ 2. Find the ID of your network adapter example: devcon hwids PCI\VEN* then find at this simple script your answer ![]() @echo off set ip=182.31.24.21 set mac=4C0010524026 set interface=Local Area Network set mask=255.255.255.0 set gateway=182.31.24.1 set dns1=212.221.112.2 rem ====================== set metric=0 set mac_reg=[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0002] devcon disable PCI\VEN_10EC echo Windows Registry Editor Version 5.00 > tmp%interface%.reg echo %mac_reg% >> tmp%interface%.reg echo "networkaddress"="%mac%" >> tmp%interface%.reg regedit /s tmp%interface%.reg del tmp%interface%.reg netsh interface ip set address name=%interface% static %ip% %mask% %gateway% %metric% netsh interface ip set dns name=%interface% static %dns1% devcon enable PCI\VEN_10EC |
|
|
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 


