Windows 10: how to disable / enable devices using command line in Windows 10

  1.    23 May 2018 #1

    how to disable / enable devices using command line in Windows 10


    Hello friends,

    Prior to updating to 1803 my headphones/laptop speakers were working just fine. When I connect my USB headphones, audio automatically redirected to headphones but not any more (after updating to 1803). Now, I need to manually disable speakers after connecting headphones (vice versa for speakers) to make them work.

    I'm more of a typing guy (text/command line etc.) than GUI so I would like to know how could I enable/device through command line. I tried DevCon tool ( DevCon Status | Microsoft Docs ) but when I run it says successful but it does NOT actually disable the device. Of course, I used "Elevated command prompt (admin)"

    Any advise on how to disable/enable devices in Windows 10 command-line please? Thanks!!

    Click image for larger version. 

Name:	image.png 
Views:	40 
Size:	39.3 KB 
ID:	189912
      My ComputerSystem Spec

  2.    23 May 2018 #2

    You could try nircmd if you don't mind third party - Nirsoft utilities are quite trustworthy.

    There is a good tutorial here : Creating a shortcut to change the default audio device in Windows
      My ComputerSystem Spec

  3.    23 May 2018 #3

    Thanks lx07 for your reply, I don't mind using 3rd party tools but unfortunately that's NOT what I need. Even using GUI, setting default audio device does not work (as I mentioned in my first post). Only IF I disable speakers then my USB headphone is working (after 1803 update), setting default audio device is not enough.

    Again, basically I need a cmd line tool that can disable an audio device (not setting default) however I tried nircmd with setdefault but doesn't do what I need. I also tried to see if I can use nircmd to disable an audio device but it doesn't seem to offer that one.

    regards,
      My ComputerSystem Spec


  4. Posts : 887
    Windows 10 Home x64 and Pro x86
       24 May 2018 #4

    Before using the suggestions below, I would urge you to check for updated drivers for your speakers / headphones because the problem you are experiencing might simply be that the currently installed drivers are not fully compatible with the latest Windows 10 updates.

    If you look at Enable or Disable Microphone - TenForums you will see the basic procedure you need to follow but, since you are talking about speakers & headphones you need to look a few lines down in the Registry to Render instead of Capture. The layout of the Capture & Render Registry keys is the same so I think there is every chance that you will be able to do what you want.

    You will probably have to experiment. I have done so a bit and I think that DeviceState 8 probably means not connected / not available. I only have my internal speakers and my Bluetooth earphones to use for comparative tests so there might be more to it than meets the eye.

    I do suggest at the every least exporting the Registry key[s] you are going to work on beforehand so you can get back to where you started if it goes wrong.
    - Export the Registry key[s] in .reg format not .txt format. You can then run the .reg file afterwards if necessary to return the key[s] to their former values.
    - Personally, I would make a system image beforehand to make sure I would be able to escape from any problems.
    - I always make system images before making any significant changes and, in this case, you will not be following a previously tested procedure [for headphones] so it is doubly important.

    If you set this up manually at first to make sure it does work then you will be able to automate it all later using the Reg command [which is not the same as RegEdit]. I think you will want to use a pair of batch files that might need to run elevated [Admin] to set it up one way or the other [toggling as you change what you connect] using commands in the form
    REG ADD HKLM\Software\MyCo /v Data /t REG_BINARY /d fe340ead
    You can get info by opening an elevated command window and entering
    Reg Add /?
    or something like this to save a copy in a text file [in a folder that exists on your computer instead of my own D:\Desktop]
    Reg Add /? >D:\Desktop\RegAddSyntax.txt

    There are examples of using Reg Add in this forum such as in "REG DELETE" from CMD prompt. Ran into a problem where you will see competent advice by @TairikuOkami and probably by other contributors.

    Best of luck,
    Denis
    Last edited by Try3; 25 May 2018 at 22:20.
      My ComputerSystem Spec


 

Related Threads
How to Enable or Disable Clipboard Sync Across Devices in Windows 10 Copy paste – it’s something we all do, probably multiple times a day. But what do you do if you need to copy the same few things again and again? How do you copy content...
How to Enable or Disable Extended Line Endings in Notepad in Windows 10 Notepad is a simple text editor included in Windows and a basic text-editing program which enables computer users to create documents. For many years, Windows Notepad...
AutoPlay lets you choose an action for different kinds of media when you plug in a device or insert media. You can set AutoPlay to open different kinds of content, such as photos, music, and video on different kinds of media, such as drives, CDs,...
i want start a Run a scheduled task via command line like this: Code: %SystemRoot%\system32\taskschd.msc /Run /TN "RegIdleBackup" when i run the cmd in the prompt as admin the shedular task GUI pop up but the task not start. Is there a...
If I use the power icon and thenclick sleep my backup software will wake up my computer and backup run myschedule. If I use any of the followingcommand lines, the software cannot wake my computer, I have ran “powercfg/h /off” at C:\windows\system32...
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 08:30.
Find Us