PC Review


Reply
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average.

The simple way to disable/enable LAN from command prompt, with a batch file, using devcon.exe

 
 
setup21@gmx.de
Guest
Posts: n/a
 
      16th Apr 2006
1.Download Devcon.exe from Microsoft:

http://download.microsoft.com/downlo...240/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"

 
Reply With Quote
 
 
 
 
Richard G. Harper
Guest
Posts: n/a
 
      16th Apr 2006
Unfortunately, this tip will only work for folks who have the same network
adapter that you do.

--
Richard G. Harper [MVP Shell/User] http://www.pcreview.co.uk/forums/(E-Mail Removed)
* 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


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 1.Download Devcon.exe from Microsoft:
>
> http://download.microsoft.com/downlo...240/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"
>



 
Reply With Quote
 
 
 
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      16th Apr 2006
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Unfortunately, this tip will only work for folks who have the same network
> adapter that you do.
>
> --
> Richard G. Harper [MVP Shell/User] (E-Mail Removed)
> * 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
>
>
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 1.Download Devcon.exe from Microsoft:
> >
> >

http://download.microsoft.com/downlo...240/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"
> >

>
>



 
Reply With Quote
 
Richard G. Harper
Guest
Posts: n/a
 
      16th Apr 2006
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] (E-Mail Removed)
* 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)" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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:



 
Reply With Quote
 
New Member
Join Date: Jul 2008
Posts: 1
 
      22nd Jul 2008
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Batch file works in command line but not as a batch Danger Windows XP General 7 5th Feb 2008 05:50 PM
Simple questions for simple 2 PC file sharing network. Simple? raylopez99 Microsoft Windows 2000 Networking 3 11th Feb 2007 02:31 PM
Simple Simple Simple craigwojo Microsoft Excel New Users 3 29th Aug 2004 05:32 AM
batch command doesn't work if called by another batch jonefer Windows XP General 3 20th Nov 2003 06:35 PM
non functional command when batch calls a batch jonefer Windows XP Accessibility 0 20th Nov 2003 12:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:42 PM.