I'm trying to write a batch file on Windows 10 that allows me to switch between my headset and my speakers as default audio device when I run it. I don't want to use any third-party software.

I tried searching around but i only found old scripts that don't seem to work and also refer to a HKCU:\Software\Microsoft\Windows\CurrentVersion\Applets\Volume Control\ path that doesn't seem to exist anymore. I cant't find any information on the Windows 10 register about this, also I'm not comfortable with fiddling too much with the register if I'm not sure of what i'm doing.

  • 1
    If you give up on not wanting too use 3rd party, I've been using audioswit.ch/er [yes that's the real URL] for about 5 years. Hot key switchable too. [no affiliation.] – Tetsujin Mar 19 '16 at 16:50

I appreciate you don't wish to use any third party software, but as an option for if you don't mind using a ~100kb exe, you can use Nircmd with the commands:

nircmd setdefaultsounddevice "Speakers" 1


nircmd setdefaultsounddevice "Headphones" 1

You need to make sure you use the exact name of your audio devices as listed under Playback Devices (right click the sound control in the system tray). It may be easier to rename them under Properties to simpler names, especially if the names clash in any way.

The 1 at the end of the command signifies "Default Device". Using 2 signifies "Default Communications Device".

If you really don't want to use a third party tool, here's a diff of a registry key that seems to change when I change my default sound device, it may be of some use to you, but I don't know exactly what it's doing. It's not as simple as a 1 or a 0 to indicate if it's a default, it would seem.

enter image description here

  • +1 from me. This is the best way to go. If you really don't want to have nircmd placed somewhere on your harddrive (believe me you want it, its great) then the alternative would be to switch it twice and make a reg export of the key mentioned here and execute the right .reg file. Not sure if this will work though, but that would be my alternative approach. – LPChip Mar 18 '16 at 18:50
  • Thanks for the answer, I actually stumbled upon nircmd myself, but was really curious as to finding a way to do that without any third party software. If no other method comes out, I'll consider using it. – zerothehero Mar 18 '16 at 22:02

Since Windows 8 (or maybe earlier?) PC's audio configuration is stored in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Render. Under Render there are GUID-named keys, each containing DeviceState dword value at root. But how is it coded?


  • 1 Active
  • 2 Disabled
  • 4 Not present
  • 8 Unplugged

So powershell/bat script to toggle between 1 and 2 should do the trick.

EDIT: To get human-readable device name, read {b3f8fa53-0004-438e-9003-51a46e139bfc},6 under Properties subkey

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.