Sign in to follow this  

Windows 7 Ethernet driver disable/enable script

Recommended Posts

Nikv    3

Hey all,

Wouldn't really know where to start with this as I'm not big into coding..

Would it be possible to create a script at startup that disables the ethernet driver, then 10-15 seconds later enables it again?

Or even have Windows start up with the ethernet driver disabled, then a script run to enable it?

Thanks

I found this:

http://social.techne...9-6d3edc97e9aa/

SetLocal EnableDelayedExpansion

set Adapter=Realtek RTL8168D/8111D Family PCI-E Gigabit Ethernet NIC (NDIS 6.20)

echo.

if /i "%1"=="enable" goto go

if /i "%1"=="disable" goto go

if /i "%1"=="toggle" goto go

echo Syntax: Device.bat enable / disable / toggle

goto :eof

:go

set HWID=x

set count=0

set found=no

set command=%1

devcon.exe hwids "PCI\*" > "%temp%\device.txt"

for /F "tokens=*" %%* in ('type "%temp%\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%==no echo Device "%Adapter%" not found. & goto exit

echo HWID=!HWID!

if /i %command%==toggle (

devcon.exe status "!HWID!" | find /i "disabled" > nul

if ErrorLevel 1 (set command=disable) else (set command=enable)

)

devcon.exe %command% "!HWID!"

:Exit

del "%temp%\device.txt"

endlocal

Unsure where to find the right version of devcon for Windows 7 though..

Just realised I need to download Windows Driver Kit (WDK) 7.1.0 althought is a couple hundred meg..

I was hoping to send this script out to several people and would be a pain having to install this on each machine to get a script to work..

Any other work arounds?

Share this post


Link to post
Share on other sites
+BudMan    2,921

Why don't you just download the WDK, extract the devcon for 32 and 64 and include that in what your sending out to the users? I have them if you need them as well - I could attach them to the thread if you need them and can not download the large file yourself.

Curious -- why do you want to do such a thing? What is the point of enabling it 15 seconds after start?

edit: attached the devcons I have - window7 64 and 32, and then one I use for xp are included

devcon.zip

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.