Windows Vista Forums

Enable/Disable Devices using Batch files

  1. #1


    Join Date : Oct 2008
    Posts : 54
    Vista Home Premium 32bit SP2
    Local Time: 20:29

    Enable/Disable Devices using Batch files

    I was wondering if there are any command line switches for devmgmt.msc so that I can write a batch file to enable or disable a certain piece of hardware.

    My problem is whenever I use my Hamachi VPN (emulated as a network card) and leave my computer on afterwords and open up Firefox, I always get 'page not found' whenever I type in an address or go to a bookmark. I then have to open up Device Manager and disable the card and then my internet browser works as usual. Then, whenever I need to use Hamachi again, I just run devmgmt.msc again and enable the card.

    I tried running 'devmgmt /?' in cmd but it just ignores the flag and runs the program. So I was wondering if there any ways to enable/disable devices using any command line program.

    I have a feeling this may also be caused because I have my ethernet connection and my Hamachi VPN set as 'Home' networks.

    Any help is appreciated.

      My System SpecsSystem Spec

  2. #2
    archie123's Avatar

    Join Date : Jul 2008
    UK
    Posts : 1,831
    Win 7 Home Premium 64bit
    Local Time: 01:29
    uk uk yorkshire

     

    Re: Enable/Disable Devices using Batch files

    you could try disabling its specific service from the command line see if that works

    Using Services.exe from the Command Line

    im sure a little research would give tha answer how to do this via a batch file , i dont think there is a way to disable it via device manager apart from the old fasioned way.....im probably wrong

      My System SpecsSystem Spec

  3. #3


    Join Date : Jul 2009
    Posts : 3
    Vista Home Premium 32bit
    Local Time: 09:29


     

    Re: Enable/Disable Devices using Batch files

      My System SpecsSystem Spec

  4. #4


    Join Date : Oct 2008
    Posts : 54
    Vista Home Premium 32bit SP2
    Local Time: 20:29


      Thread Starter

    Re: Enable/Disable Devices using Batch files

    Thanks a lot for that program. I recall reading about that program before but I never bothered to learn how to use it.

    I did "devcon hwids * > hw.txt" to list all the hardware devices and one I found Hamachi's device ID, I wrote a batch file to enable it by "devcon /r enable hamachi" and disable by "devcon /r disable hamachi".

      My System SpecsSystem Spec

Enable/Disable Devices using Batch files

Similar Threads
Thread Forum
DEP - Enable or Disable
How to Enable or Disable DEP in Vista, Windows 7, and Windows 8 Data Execution Prevention (DEP) is a security feature that can help prevent...
Tutorials
Audio Device - Enable Hidden Devices
How to Enable Hidden Audio Devices in Vista and Windows 7 This will show you how to enable hidden disabled audio devices in the Sound Control...
Tutorials
Enumerate/Enable/Disable Devices
The Microsoft tool devcon.exe (http://download.microsoft.com/download/1/1/f/11f7dd10-272d-4cd2-896f-9ce67f3e0240/devcon.exe) lets me enumerate,...
VB Script
Disable USB devices
I have a client that would like to disable usb devices on certian client computers. They are running sbs 2003.
SBS Server
Defragment Boot Files - Enable or Disable
How to Enable or Disable Defrag of Boot Files at Startup in Vista This will show you how to enable or disable the defragging of the boot files...
Tutorials
Disable and Enable Devices
How can I get a list of my local computer devices? How can I enable or disable them? Thanks!!
PowerShell
Select Files - Disable or Enable Full Row Select
How to Enable or Disable Full Row Select in Vista Windows Explorer Normally when you move your mouse pointer over a file row in Details view in...
Tutorials