Creating a shortcut to change the default audio device in Windows

by Shijaz Abdulla on 13.05.2013 at 15:25

Most of us use multiple audio devices. Sometimes its a headset, at other times it’s the default laptop speakers, and at other times it might a speaker system connected to your docking station or even a webcam microphone.

Unfortunately, switching between the various audio devices can be tedious as you need to change the Windows “default device” or the “default communications device” each time for both recording and playback.

Today we’re going to see how you can create simple shortcuts on your taskbar that let you effortlessly switch between audio devices.

image

The three shortcuts you see in my little “Audio Control” custom toolbar let me switch between by Microsoft LifeChat LX-3000 headset, Internal Speakers and Logitech c920 HD webcam microphone. Here’s how I created these shortcuts:

Note: I have tried this on Windows 8, but I am pretty sure it will work on Windows 7 too.

1. Download the NIRCMD utility and extract it to a folder on your computer, let’s call it C:\NIRCMD

2. Open your Windows Playback devices (Right click on your speaker icon on the taskbar).

image

Note the names of each of the devices you need to change. You can click on Properties to view the correct name. You will need the exact same name for the NIRCMD command to work. If you have two devices with the same name (example: “Speakers”) you will need to rename one of them so that they are unique. Click Properties if you need to rename devices.

Note the names in a text file for easy copy-paste.

In my case, the three playback device names are:

  • “Headset Earphone”
  • “Speakers”

3. Do the same with recording devices. Note the names in a text file. In my case the names of my 3 recording devices are:

  • “Headset Microphone”
  • “Microphone”
  • “C920 Microphone” (renamed)

4. Now open the C:\NIRCMD folder, create a new batch file for each device, let’s call them SPEAKERS.BAT, HEADPHONE.BAT, and WEBCAM.BAT

5. Use similar commands as below for each of the BAT files. Use the device names you copied earlier.

SPEAKERS.BAT

@ECHO OFF
C:\NIRCMD\NIRCMDC setdefaultsounddevice "Speakers" 2
C:\NIRCMD\NIRCMDC setdefaultsounddevice "Internal Microphone" 2
C:\NIRCMD\NIRCMDC setdefaultsounddevice "Speakers" 1
C:\NIRCMD\NIRCMDC setdefaultsounddevice "Internal Microphone" 1

HEADSET.BAT

@ECHO OFF
C:\NIRCMD\NIRCMDC setdefaultsounddevice "Headset Earphone" 2
C:\NIRCMD\NIRCMDC setdefaultsounddevice "Headset Microphone" 2
C:\NIRCMD\NIRCMDC setdefaultsounddevice "Headset Earphone" 1
C:\NIRCMD\NIRCMDC setdefaultsounddevice "Headset Microphone" 1

WEBCAM.BAT

@ECHO OFF
C:\NIRCMD\NIRCMDC setdefaultsounddevice "Speakers" 2
C:\NIRCMD\NIRCMDC setdefaultsounddevice "C920 Microphone" 2

Notes:

  • The “1” in the NIRCMD command line argument indicates that the device is set as “Default Device”. A “2” in the command indicates that the device will be set as a “Default Communications Device” (useful for Skype, Lync etc).
  • The device name string should be EXACTLY the same that is defined in Windows.

6. Test each batch file by double clicking on them and observing if the default device changed.

7. Create a folder "Audio Control” for your custom toolbar. Your NIRCMD folder should look like the below now.

image

7. Inside the Audio Control folder, create three shortcuts to the batch files that you created in step 5. Click Change Icon in the shortcut file properties if you want to change the icons like I have done.

8. Right click on an empty space on your taskbar and choose New toolbar.

image

 

9. Choose the C:\NIRCMD\Audio Control folder. You now have an awesome new Audio Controls toolbar.

You will appreciate the one-click ease with which you can now change your default audio device in Windows. Leave a comment and let us know your feedback! 🙂

Trackback Permanent Link

60 Responses to Creating a shortcut to change the default audio device in Windows

  1. remi says:

    Thanks A LOT.
    this tutorial was perfect, and the result is working fine. It’s well looking too, perfect !

  2. Peter says:

    Thank you for this instructions! This is exactly what I needed!

  3. m9 says:

    Since this caused me a headache to figure out since it wouldn’t work for me, after running nircmd and copying it to windows, I had to use a line like this:

    @ECHO OFF
    nircmd setdefaultsounddevice “Speakers” 1
    nircmd setdefaultsounddevice “Speakers” 2

    for it to actually change the speakers or headphones. So if that helps anyone there. Thanks either way.

  4. Michael says:

    This solution is brilliant. No installation of external programs needed. I love it!
    Too bad though that large shortcut icons are actually higher than quick launch toolbar but it’s microsoft…

  5. Tom Yerkes says:

    Thanks so much! Exactly what I was looking for! I did mine a little different and thought I would share. I just wanted to switch between my headset and speakers with one click. So I made my bat a toggle switch by doing the following…..
    ====================================
    @ECHO OFF
    if exist toggle.txt goto :2

    C:\NIRCMD\NIRCMDC setdefaultsounddevice “Speakers” 2
    C:\NIRCMD\NIRCMDC setdefaultsounddevice “Speakers” 1
    echo toggle>>toggle.txt

    exit
    :2
    C:\NIRCMD\NIRCMDC setdefaultsounddevice “SHARP HDMI” 2
    C:\NIRCMD\NIRCMDC setdefaultsounddevice “SHARP HDMI” 1
    del toggle.txt /q

    exit
    ===================================

    in my case my speakers default to my headset when plugged in and the sharp hdmi is actually a tv that I have hooked up as a monitor that I also play the sound through via hdmi.

    Thanks again for this awesome tutorial!

    • I did some changes to your script. Just try it.
      ====================================
      @ECHO OFF
      if exist toggle.txt goto :2

      C:\NIRCMD\NIRCMDC setdefaultsounddevice “Speakers” 2
      C:\NIRCMD\NIRCMDC setdefaultsounddevice “Speakers” 1
      C:\NIRCMD\NIRCMDC trayballoon “Selected audio device” “Speakers” “C:\NIRCMD\NIRCMDC\speakers-01.ico” 15000
      echo toggle>>toggle.txt

      exit
      :2
      C:\NIRCMD\NIRCMDC setdefaultsounddevice “SHARP HDMI” 2
      C:\NIRCMD\NIRCMDC setdefaultsounddevice “SHARP HDMI” 1
      C:\NIRCMD\NIRCMDC trayballoon “Selected audio device” “SHARP HDMI” “C:\NIRCMD\NIRCMDC\HDMI-01.ico” 15000
      del toggle.txt /q

      exit
      ===================================
      You must to put full path to icon files (you can use dll files for icons, see nircmd help online).

      • Rzehooj says:

        And here goes my version with registry toggle (this is for windows 7 and if you want use it on older system change skip=2 to skip=4 and icon location):
        @echo OFF
        setlocal ENABLEEXTENSIONS
        set KEY_NAME=”HKEY_CURRENT_USER\Software\Custom”
        set VALUE_NAME=Headphones

        FOR /F “usebackq skip=2 tokens=1-3” %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO (
        set ValueValue=%%C
        )
        if defined ValueValue (
        if %ValueValue% == 0x0 (
        nircmd setdefaultsounddevice Headset
        nircmd mutesysvolume 0 “Microphone”
        reg add %KEY_NAME% /t REG_DWORD /v %VALUE_NAME% /d 1 /f >nul
        nircmd trayballoon “Headphones” “Selected audio device” “C:\Windows\system32\mmres.dll,6” 2500
        )
        if %ValueValue% == 0x1 (
        nircmd setdefaultsounddevice Speakers
        nircmd mutesysvolume 1 “Microphone”
        reg add %KEY_NAME% /t REG_DWORD /v %VALUE_NAME% /d 0 /f >nul
        nircmd trayballoon “Speakers” “Selected audio device” “C:\Windows\system32\mmres.dll,1” 2500
        )
        ) else (
        @echo Not found %KEY_NAME%\%VALUE_NAME%.
        )

        You may also use free bat to exe converter (http://www.f2ko.de/programs.php?lang=en&pid=b2e) to make cmd window that shows up for 0.1 sec invisible and choose some icon (for example mmres.dll,6 that you can extract with another nirsoft application – http://www.nirsoft.net/utils/iconsext.zip) for your script file.

        • Rzehooj says:

          Ups… forgot to tell that you should create new key in registry before you run script or change that part:

          ) else (
          @echo Not found %KEY_NAME%\%VALUE_NAME%.
          )

          to:

          ) else (
          reg add %KEY_NAME% /t REG_DWORD /v %VALUE_NAME% /d 0 /f >nul
          )

          Then run this script twice (one for registry creation and second for actual script execution). Don’t forget to select your speakers as default audio device before you run it for your first time or otherwise you’ll be forced to change value in registry manually!

          • Blah says:

            Keep seeing the following everytime :

            FOR /F “usebackq skip=2 tokens=1-3″%A IN (‘REG QUERY “HKEY_CURRENT_USER\Software\Custom” /v Headphones 2>nul’) DO (
            set ValueValue=%C )
            ( was unexpected at this time.

          • Blah says:

            issue was due to copy paste method had changed the ` to ‘ they should remain backquotes.

  6. DT says:

    Great thanks. My only issue is the new toolbar icons are tiny and I can’t get them large like yours in the screenshots.

  7. Fantastic, awesome!! Also Tom Yerkes’s contribution.
    Here my small molehill. You can avoid the annoying black cmd window by right clicking the shorcut, properties, run minimized, accept.
    Thanks a lot!!

  8. Espen says:

    Thanks for the tutorial, works very good, but my icons are small, any way to change that? Doesn’t fill the height of the bar, looks a bit weird..

  9. SamKook says:

    To make the icons bigger, you simply have to right-click the new toolbar(the toolbar itself, not the icons it contain) and you’ll see the options at the top of the option menu.
    You can also disable the text and the title of the toolbar.

    I can confirm it works on windows 7 and according to nircmd doc, it should also work on vista.

    I’m surprised this toolbar feature is even available on windows XP(nircmd can’t change the sound device though so this tutorial won’t work), it’s the first time I’ve seen it being used(well, the second time actually now that I think about it, a user somehow managed to do this without knowing how and I helped him get rid of it. Now I know what that was at least).

  10. SamKook says:

    Meant to say context menu, not option.

  11. Pingback: FINALLY Made up my mind, making a purchase tomorrow...not popular choice here though...

  12. MR says:

    Hello , i need to change default device and ALSO the Sound quality, I need to change , cd quality, dvd quality, quality phone … etc

    Any one can help me ?

  13. Vern says:

    Brilliant, thanks! I’ve been looking for a way to switch the default display and sound device to my home theater and back again. This really helps eliminate a lot of clicking when I decide I want to play games via the 58″ screen rather than the 24″ one. I simply added “setprimarydisplay 1” and “setprimarydisplay 2” to the appropriate BAT files. Works great! When I have time, I will tinker with the toggle method mentioned in the comments above.

    Oh yeah, and rather than a separate toolbar, I just made shortcuts to the BAT files and added them to my Launchy folder so I can access them quickly.

    Thanks again!!!

  14. Simon says:

    Thank you so much! This worked perfectly + all the comments were really helpful.

  15. Don Smith says:

    Thanks, Shijaz! Works great. So much hassle avoided.

  16. MANNie says:

    I can’t get it to work with my Sony TV. I have it hooked up via hdmi cable and it CAN be set as default manually in the Playback Devices window.

    Nircmd is copied to windows directory, the shortcuts and .bat files I made work for ‘Headphones’ and ‘Speakers’ work perfectly, but ‘SONY TV’ doesn’t work the same. I tried changing the name (was originally called ‘SONY TV XV-4’ or something) but it still doesn’t do anything. (the name doesn’t change back to default when disconnected then reconnected and there are no duplicate names). Any ideas why this isn’t working?

    • MANNie says:

      Working now! figured out, on my PC (win8) it had to be a 1 word name, so SONY TV didn’t work but SONYTV did! took more than a day for me to think of trying that.

  17. Moe says:

    Worked fine with me with either nircmd or nircmdc with bat files located in the same folder and without all the folder arborescence name before mircmd.
    I created shortcut for speaker/ headphone bat and then changed the icons (to the same icons of my devices) and did opy both shortcuts to the quicklanch folder created/restored in windows seven taskbar C:\Users\XUSER\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch : you could choose small icons of big. , small worked for me as my quicklaunch has autohide and contains all my frequently used icon with autohide option on to allow you to maximise screen usable area.
    [IMG]http://i925.photobucket.com/albums/ad100/berbirable/KVM/Forums/Sounddevicequickswitching.png[/IMG]

  18. F says:

    faster way for linking sound devices tabs:

    Playback Tab
    %windir%\System32\rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,0
    Recording Tab
    %windir%\System32\rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,1
    Sounds Tab
    %windir%\System32\rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,2
    Communications Tab
    %windir%\System32\rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,3

    source:
    http://www.sevenforums.com/tutorials/56892-sound-shortcuts-create.html

  19. Thanks people!!! Stuff works like a charm!
    Sharing this post via twitter!

  20. Tom says:

    Excellent solution ! Thanks for the procedure and the Nir developer!
    /T

  21. Oliver says:

    Thanks a lot! Really handy. Finally found a use for the macro keys on my keyboard.

  22. akira6968 says:

    Thank you SO MUCH. HDMI to watch TV (pass thru to receiver), but when TV is off I need audio out the headphone jack (spotify remote is awesome)… and having to go in and change the default back to HDMI made this HTPC literally useless to the wife lol. Your article has made it useful (to her) again 🙂

  23. Jolly says:

    I couldn’t get nircmd to copy to windows so it wont work for me in Win 7.

    • Gino says:

      Run as admin to copy to windows directory and remove the path for nircmd. Else you must use the correct path to nircmd.

    • JonnyDee says:

      @Jolly The FAQ from the website suggests R-Clk on nircmd.exe and go to Properties … select ‘unblock’ .Are you logged in as an administrator? I didnt have any problem copy to C:\Windows\nircmdc.exe . My problem is that all I get is a flash of the console screen and the command doesnt work (command copied direct out of help url)

  24. Jose says:

    GREAT. work like a charm thanks.

  25. mombassa jesus says:

    Thanks very much for this; very helpful.

  26. Mauro says:

    Works great in Windows 8.1 64 bits and Windows 7 32 bits. Thanks a lot!

  27. Wolfman says:

    Thank you so much! I appreciate your knowledge. Thank you for sharing this.

    😀

  28. Daniel says:

    AWESOME MAN. It made it much easier!

  29. Biggs says:

    Thanks so much! Worked like a charm 🙂

  30. Danilo Peretti de Castro says:

    uau, really thank this article! How could I live without this NIRCMD? hehehe It saved me cause I use headphones and often I forget and go to another place then people could not reach me cause I couldn’t hear Skype or Hangout. Amazing!!!

  31. Artago says:

    Thanks a lot for this tutorial.

    It works for me, but most times I have to click on it twice. It changes the default, but doesn’t change the sound output until I click or run the bat file for a second time.

    Another thing, how can I prevent the toolbar from showing the labels, I’d like to have all the icons in the task bar like the image you upload.

  32. LordOsslor says:

    Perfect! It works so grate!

  33. Alex says:

    Thank you very much! It was so annoying switching between speakers and headset, but now it works so easily!

  34. Pingback: Audio Switcher DIY Windows 10 – Ronald van Heugten

  35. Craig says:

    Thanks, I found this very helpful.

  36. Paulo says:

    Man, you saved my life 😛

  37. Alex van Hoek says:

    Still working (Windows 10, 64bit) and is exactly what I wanted.

  38. Mark Cassidy says:

    Perfect. Thank you for this. Quick tip: I had 2 devices identifying themselves as “Speaker”. Disable the one you don’t need.

  39. Ed says:

    Worked like a charm! Really appreciate the info, bud!

  40. Dragon Fighter says:

    Great work!!! Win10 lost autodetect somehow. This is my solution 😉

  41. Graeme says:

    Excellent – Great Tutorial, done exactly what was required. In our case a Display Port monitor with no speakers was the default device, not the Sound card. Thank you very much.

  42. SkipperMike says:

    Nircmd not a recognized cmd in Win10

  43. Dan says:

    Thank you! Bigup!

Leave a Reply