I have speakers and a USB headset (G35). I want to easily switch between thous two playback devices without having to go to Playback devices and change the default playback device manually. Preferredly using the G-keys.


Getting started

First you need to download NirCmd. It doesn't require any installation.

NirCmd is a small command-line utility that allows you to do some useful tasks without displaying any user interface.

NirCmd has a nifty command called setdefaultsounddevice which we need.


setdefaultsounddevice [Device Name] {Role}

Set the default sound device on Windows 7/Vista/2008. The [Device Name] is the name of the device, as appeared in the sound devices list of windows, for example: Speakers, Line In, Microphone, and so on... The {Role} parameter is optional and may countain one of the following values: 0 for Console (the default value), 1 for Multimedia, and 2 for Communications.

Once you've downloaded the program you can put it in either your windows folder or a folder of your choosing. If you put it in your windows folder you don't have to know the location of the nircmd.exe file. More on that later.

Finding [Device Name]

Now we need to find your [Device Name]. Go to: Control Panel\Hardware and Sound\Sound and locate your devices. They'll most likely be called Speakers.

Playback devices

You'll need to change one of the names. I prefer to change the onboard sound device because once you unplug USB headset and plug it back in the device name will have reset to Speakers. You rename a device by choosing properties on the device and typing in the name you want in the top field.

Device properties

When that's done you should have two playback devices, one called Speakers (headset) the other LoudSpeakers.

Using NirCmd

We can now use NirCmd to switch to the desired device. Like so:

> nircmd.exe setdefaultsounddevice Speakers

However I found that Skype (In my case) doesn't change when this is run. So we need to use the optional {Role} parameter as well.

> nircmd.exe setdefaultsounddevice Speakers
> nircmd.exe setdefaultsounddevice Speakers 2

Luckily NirCmd support scripts. So lets create two scripts one that switches to our speakers and one that switches to our headset.


setdefaultsounddevice "Speakers"
setdefaultsounddevice "Speakers" 2


setdefaultsounddevice "LoudSpeakers"
setdefaultsounddevice "LoudSpeakers" 2

You can create these using Notepad. They're just text files with a .ncl extension instead of .txt. Put them in a convenient location. We'll need the shortly.

Switch playback device using the Logitech G keys

Depending on your decision where to place the nircmd.exe file the following may differ. I'll be using the solution where I don't place nircmd.exe in the windows folder.

Now you need to go to the Logitech Gaming Software (driver) to bind your G keys to these scripts. Select the button you want to bind and choose Shortcut, choose an appropriate name and type in the path to nircmd.exe and the .ncl script in want to run.

"X:/Audio switch/nircmd.exe" script "X:/Audio switch/SwitchToSpeakers.ncl"

Remember to bind both SwitchToHeadset and SwitchToSpeakers.

G key layout

You're done! Enjoy.

  • One way not to put nircmd in the windows folder would be to have a seperate folder for things in path amd add that to path in environmental variables. I do this with my windows boxen so i have access to various gnu tools
    – Journeyman Geek
    Jun 17 '12 at 14:33
  • Correct, I didn't cover that as it may confuse and super users already know this :)
    – Snæbjørn
    Jun 17 '12 at 14:39
  • Hey I think that OP meant the G-Keys from the headset itself.... ( img.hexus.net/v2/lifestyle/logitech/G35/G35buttons-big.jpg )
    – kluka
    Nov 4 '12 at 14:43
  • If you install nircmd with cholocatey it is already on the PATH btw so you don't need to add the fullpath to the binary
    – Dominik
    Mar 18 at 16:11

I found an easier solution.

I used this helpful little app here (audioswitcher) and I mapped the sound setting to some keystrokes, and then mapped them to the buttons on the side of the headset.

Same end result, but an easier path to get there, and the app is useful anyway if you have numerous sound output devices to manage.


Here is another alternative using a different program called "Audioswitch":

  • Download & Install Audioswitch https://github.com/sirWest/AudioSwitch/releases

  • Open Audioswitch settings from the taskbar menu and disable all the audio devices you DON'T want it to switch to. (Be sure to click "Save Setting" in bottom right corner after disabling each unwanted device.)

  • Go to the "Hot Keys" tab and choose either "PreviousPlaybackDevice" or "NextPlaybackDevice" (it doesn't matter) and make a hotkey for it. (I choose to use "Shift+F3" but feel free to use any combo you like.) Exit the menu by clicking "Apply Hotkeys & Close".

  • Open Logitech Gaming Software and set your preferred Logitech "G" key to mimic whatever key(s) you choose to use from the "Hot Key" menu in the previous step. (I choose to map this to the "G3" key because it was my next available.)

Logitech Gaming Software Example Screenshot


I tried this with my Steelseries Apex 350 and got it to work as following:

  • I used the AudioSwitcher app mentioned above. link

  • I edited the Hotkeys in the App itself beeing "F1+1" for output 1 and "F2+2" for output 2.

  • I then proceeded to make a macro for the MX1 and MX2 button, setting them to the Hotkeys provided above. (making a macro in the Steelseries Rival Software is pretty easy, further explenation not necessary I guess...)

TL/DR: Set Hotkey in app and set same hotkeys with Rival Software for fast switching

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.