Switch Default Sound Device from Command Line in Windows

If you have a couple of sound cards installed on your Windows machine for recording or editing purposes, switching them is an everyday activity. Though Windows provides a clean user interface to do this, it takes a couple of steps, and sometimes it is even buggy, which I did face with my Bluetooth Device. So, it would be best to have a one-click switch option to change the default device or switch default sound device from the command line to the one you want.

Change Default Audio Device Windows

Switch Default Sound Device from Command Line in Windows

NirSoft has command line tools with 3 new tools that work on Windows’s Volume or Sound control options. One such tool is nircmd setdefaultsounddevice which, when run from command tools with the argument as device name, the change is instant.

The other two tools are:

  • setsubunitvolumedb: This allows volume level in DB. It doesn’t support percentages till now, so you might get confused.
  • mutesubunitvolume: This allows you to mute any sound device like Mic, Line In, etc.

Switch Default Device Commandline

How to use the nircmd change audio device tool

  • Download the NirCMD software (cmd change audio device) from here
  • Click to install in Windows Directory.
  • Now, Let’s say you have two playback devices, “Device One” and “Device Two”
  • Right-click on the desktop and click on New > Shortcut. Type in C:\Windows\nircmdc.exe. Assuming your Windows Directory is in C :
  • Once the shortcut change audio device is ready, right-click and select Properties > Target.
  • Here, you must add a command option to help you switch.
  • For Device One, it should be
C:\Windows\nircmd.exe setdefaultsounddevice "deviceone"
  • Change “deviceone” to “devicetwo”

Switch Default Device Shortcut

You can also type in the same thing over the command line, which will work. The idea is to create a shortcut so you can switch faster, or else it will be cumbersome again to change the default communication device. Or you can setup windows hotkey change audio device to do it right from the desktop.

Video demo: How to change default playback devices

How to change default audio device through the command line in Windows – Using Windows PowerShell

Although there are plenty of Third-Party applications available for the said task, the below-mentioned steps by way of Windows PowerShell can help the cause:

  • Open the Windows PowerShell

Press the Windows+X key together and choose Windows PowerShell from the list of options.

  • List of available audio devices

Before switching audio devices, the below-mentioned command can help display the list of the available ones, along with their Properties.

Get-AudioDevice -list
  • Switch and set default audio device

The command below can be entered in the Windows Powershell to switch to a different audio device and set the same as the default.

Set-AudioDevice -Playback -Default -DeviceName "DeviceName" 

In the above command, the Playback option signifies that the user is configuring a playback audio output device. The Default option ensures that the said device is set as the default audio device in the system.

DeviceNamein the present context needs to be replaced with the name of the audio device, as shown in the list as appearing in the list of audio devices in (1). For example, if “Headphones” are to be set as the default, the same can be achieved through the following command line instruction in the Powershell

Set-AudioDevice -Playback -Default -DeviceName "Headphones"

I hope the post was easy to understand and that you could switch between multiple devices. The tool has many other features, including nircmd mute microphone, support for line in device and more.

Sandip Basu
Sandip has worked as an IT solutions consultant for the last 15 years and specializes in troubleshooting software and hardware.

3 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here