Jump to content

How to program Enable, Disable drivers?


Recommended Posts

Posted

I am able to enable or disable usb controller through device

manager... Can I do it through program(vb) or registry?

  • Replies 5
  • Created
  • Last Reply
Guest Pegasus \(MVP\)
Posted

Re: How to program Enable, Disable drivers?

 

 

"Yajiv" <yajiv.vijay@gmail.com> wrote in message

news:ecc7d34a-4bf5-4ab1-9f3a-e3b0dbce7d50@c36g2000prc.googlegroups.com...

>I am able to enable or disable usb controller through device

> manager... Can I do it through program(vb) or registry?

 

Here is a batch file that will let you do it:

@echo off

goto Start

-------------------------------------------------

Use this batch file to enable or disable a device

from the Command Prompt.

 

Prerequisite: c:\Windows\devcon.exe

 

16.4.2006 FNL

-------------------------------------------------

:Start

setlocal enabledelayedexpansion

set Device=ALi PCI to USB Open Host Controller

 

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: %Device%" set found=yes& set count=1

if !found!==yes if !count!==3 set HWID=%%*

)

if %found%==yes (

echo HWID=!HWID!

devcon.exe %1 "!HWID!"

) else (

echo Device "%Device%" not found.

)

endlocal

del device.txt

 

Instructions:

- Copy & paste these lines into c:\Windows\Device.bat

- Adjust Line 13 to reflect the name of your USB controller.

- Download devcon.exe and store it in c:\Windows

(http://download.microsoft.com/download/1/1/f/11f7dd10-272d-4cd2-896f-9ce67f3e0240/devcon.exe)

- Invoke the batch file in either of these modes:

Device enable

Device disable

Posted

Re: How to program Enable, Disable drivers?

 

On Oct 21, 2:27 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

> "Yajiv" <yajiv.vi...@gmail.com> wrote in message

>

> news:ecc7d34a-4bf5-4ab1-9f3a-e3b0dbce7d50@c36g2000prc.googlegroups.com...

>

> >I am able to enable or disable usb controller through device

> > manager... Can I do it through program(vb) or registry?

>

> Here is a batch file that will let you do it:

> @echo off

> goto Start

> -------------------------------------------------

> Use this batch file to enable or disable a device

> from the Command Prompt.

>

> Prerequisite: c:\Windows\devcon.exe

>

> 16.4.2006 FNL

> -------------------------------------------------

> :Start

> setlocal enabledelayedexpansion

> set Device=ALi PCI to USB Open Host Controller

>

> 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: %Device%" set found=yes& set count=1

>   if !found!==yes if !count!==3 set HWID=%%*

> )

> if %found%==yes (

>   echo HWID=!HWID!

>   devcon.exe %1 "!HWID!"

> ) else (

>   echo Device "%Device%" not found.

> )

> endlocal

> del device.txt

>

> Instructions:

> - Copy & paste these lines into c:\Windows\Device.bat

> - Adjust Line 13 to reflect the name of your USB controller.

> - Download devcon.exe and store it in c:\Windows

>   (http://download.microsoft.com/download/1/1/f/11f7dd10-272d-4cd2-896f-...)

> - Invoke the batch file in either of these modes:

>    Device enable

>    Device disable

 

Exactly what i wanted. But i have some issues.

The downloaded exe was a self extracting file.

Where should i put the extracted files?

Guest Pegasus \(MVP\)
Posted

Re: How to program Enable, Disable drivers?

 

 

"Yajiv" <yajiv.vijay@gmail.com> wrote in message

news:57070505-fd34-4b5d-916e-a4e3184a560b@g17g2000prg.googlegroups.com...

On Oct 21, 2:27 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

> "Yajiv" <yajiv.vi...@gmail.com> wrote in message

>

> news:ecc7d34a-4bf5-4ab1-9f3a-e3b0dbce7d50@c36g2000prc.googlegroups.com...

>

> >I am able to enable or disable usb controller through device

> > manager... Can I do it through program(vb) or registry?

>

> Here is a batch file that will let you do it:

> @echo off

> goto Start

> -------------------------------------------------

> Use this batch file to enable or disable a device

> from the Command Prompt.

>

> Prerequisite: c:\Windows\devcon.exe

>

> 16.4.2006 FNL

> -------------------------------------------------

> :Start

> setlocal enabledelayedexpansion

> set Device=ALi PCI to USB Open Host Controller

>

> 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: %Device%" set found=yes& set count=1

> if !found!==yes if !count!==3 set HWID=%%*

> )

> if %found%==yes (

> echo HWID=!HWID!

> devcon.exe %1 "!HWID!"

> ) else (

> echo Device "%Device%" not found.

> )

> endlocal

> del device.txt

>

> Instructions:

> - Copy & paste these lines into c:\Windows\Device.bat

> - Adjust Line 13 to reflect the name of your USB controller.

> - Download devcon.exe and store it in c:\Windows

> (http://download.microsoft.com/download/1/1/f/11f7dd10-272d-4cd2-896f-...)

> - Invoke the batch file in either of these modes:

> Device enable

> Device disable

 

Exactly what i wanted. But i have some issues.

The downloaded exe was a self extracting file.

Where should i put the extracted files?

=============

It does not matter in the least, as long as you follow my previous

instruction:

- Download devcon.exe and store it in c:\Windows.

Posted

Re: How to program Enable, Disable drivers?

 

On Oct 21, 7:39 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

> "Yajiv" <yajiv.vi...@gmail.com> wrote in message

>

> news:57070505-fd34-4b5d-916e-a4e3184a560b@g17g2000prg.googlegroups.com...

> On Oct 21, 2:27 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

>

>

>

> > "Yajiv" <yajiv.vi...@gmail.com> wrote in message

>

> >news:ecc7d34a-4bf5-4ab1-9f3a-e3b0dbce7d50@c36g2000prc.googlegroups.com....

>

> > >I am able to enable or disable usb controller through device

> > > manager... Can I do it through program(vb) or registry?

>

> > Here is a batch file that will let you do it:

> > @echo off

> > goto Start

> > -------------------------------------------------

> > Use this batch file to enable or disable a device

> > from the Command Prompt.

>

> > Prerequisite: c:\Windows\devcon.exe

>

> > 16.4.2006 FNL

> > -------------------------------------------------

> > :Start

> > setlocal enabledelayedexpansion

> > set Device=ALi PCI to USB Open Host Controller

>

> > 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: %Device%" set found=yes& set count=1

> > if !found!==yes if !count!==3 set HWID=%%*

> > )

> > if %found%==yes (

> > echo HWID=!HWID!

> > devcon.exe %1 "!HWID!"

> > ) else (

> > echo Device "%Device%" not found.

> > )

> > endlocal

> > del device.txt

>

> > Instructions:

> > - Copy & paste these lines into c:\Windows\Device.bat

> > - Adjust Line 13 to reflect the name of your USB controller.

> > - Download devcon.exe and store it in c:\Windows

> > (http://download.microsoft.com/download/1/1/f/11f7dd10-272d-4cd2-896f-....)

> > - Invoke the batch file in either of these modes:

> > Device enable

> > Device disable

>

> Exactly what i wanted. But i have some issues.

> The downloaded exe was a self extracting file.

> Where should i put the extracted files?

> =============

> It does not matter in the least, as long as you follow my previous

> instruction:

> - Download devcon.exe and store it in c:\Windows.

 

I am getting an error "no device is disabled" at the end and the

device is not disabled.

 

but the line echo HWID=!HWID! is listing the right driver "pci\****"

Guest Pegasus \(MVP\)
Posted

Re: How to program Enable, Disable drivers?

 

 

"Yajiv" <yajiv.vijay@gmail.com> wrote in message

news:e3c3dfaf-56e8-4ac2-81db-a5cdda4dc27e@e2g2000hsh.googlegroups.com...

On Oct 21, 7:39 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

> "Yajiv" <yajiv.vi...@gmail.com> wrote in message

>

> news:57070505-fd34-4b5d-916e-a4e3184a560b@g17g2000prg.googlegroups.com...

> On Oct 21, 2:27 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

>

>

>

> > "Yajiv" <yajiv.vi...@gmail.com> wrote in message

>

> >news:ecc7d34a-4bf5-4ab1-9f3a-e3b0dbce7d50@c36g2000prc.googlegroups.com...

>

> > >I am able to enable or disable usb controller through device

> > > manager... Can I do it through program(vb) or registry?

>

> > Here is a batch file that will let you do it:

> > @echo off

> > goto Start

> > -------------------------------------------------

> > Use this batch file to enable or disable a device

> > from the Command Prompt.

>

> > Prerequisite: c:\Windows\devcon.exe

>

> > 16.4.2006 FNL

> > -------------------------------------------------

> > :Start

> > setlocal enabledelayedexpansion

> > set Device=ALi PCI to USB Open Host Controller

>

> > 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: %Device%" set found=yes& set count=1

> > if !found!==yes if !count!==3 set HWID=%%*

> > )

> > if %found%==yes (

> > echo HWID=!HWID!

> > devcon.exe %1 "!HWID!"

> > ) else (

> > echo Device "%Device%" not found.

> > )

> > endlocal

> > del device.txt

>

> > Instructions:

> > - Copy & paste these lines into c:\Windows\Device.bat

> > - Adjust Line 13 to reflect the name of your USB controller.

> > - Download devcon.exe and store it in c:\Windows

> > (http://download.microsoft.com/download/1/1/f/11f7dd10-272d-4cd2-896f-...)

> > - Invoke the batch file in either of these modes:

> > Device enable

> > Device disable

>

> Exactly what i wanted. But i have some issues.

> The downloaded exe was a self extracting file.

> Where should i put the extracted files?

> =============

> It does not matter in the least, as long as you follow my previous

> instruction:

> - Download devcon.exe and store it in c:\Windows.

 

I am getting an error "no device is disabled" at the end and the

device is not disabled.

 

but the line echo HWID=!HWID! is listing the right driver "pci\****"

=====================

 

Maybe the device you're trying to disable can't be disabled. You need to

explore this issue by using manual means, e.g. like so:

1. Open a Command Prompt.

2. Type these commands:

devcon hwids "PCI\*" > device.txt

notepad device.txt

3. Locate your device name.

4. Type this command:

devcon.exe disable xxx

where "xxx" is one of the several identifiers you find below the device name

in Step 3.


×
×
  • Create New...