The new version of NirCmd provides 3 new commands to control the sound volume on Windows 7/Vista/2008:

  1. setdefaultsounddevice – Allows you the set the default sound device on Windows 7/Vista/2008, exactly like you can do it from this window:
    Set Default Sound Device

    Set Default Sound Device

    Example for using this command:
    NirCmd.exe setdefaultsounddevice “Line In”

  2. setsubunitvolumedb – Allows you the set the sound volume level of subunits of a sound device, as you can do in the following device properties window:
    Speakers Properties Window

    Speakers Properties Window

    As opposed to the above user interface of Windows, which allows you to set the volume level in percent scale, the command of NirCmd only allows you to set the volume level in decibel unit. So far, I couldn’t locate the exact formula that Microsoft uses to convert the decibel values into %.
    Examples for using the setsubunitvolumedb command:
    setsubunitvolumedb “Speakers” “Line In” -12
    setsubunitvolumedb “Speakers” “Microphone” -20

  3. mutesubunitvolume – Allows you to mute/unmute the subunits of a sound device.
    Examples for using the mutesubunitvolume command:
    mutesubunitvolume “Speakers” “Line In” 0
    mutesubunitvolume “Speakers” “Microphone” 1

19 Comments

  1. Jonathan Kay says:

    Nir, I’ve wanted to be able to do this for a long time without silly hacks and/or UI automation. This is *great*.
    Thank you very much.

  2. framing basement walls says:

    To Nir, I really appreciate you posting this. I wanted to have this function since then. It is really nice if you are able to control and manage the volume of your devices separately. The additional features are interesting.

  3. joshtravolta says:

    Wow, this looks really promising. So far I was not able to find a tool to simply switch between my playback devices in Win7.

    I will give it a try once I’m home today.
    Thanks for your work 😀

    cheers from Berlin, Germany
    josh

  4. Mac says:

    This is perfect for us who switch video sources to the TV via a batch file. thanks

  5. Daniel Ceregatti says:

    How does one toggle the muting of the microphone in the “Recording” tab? When I use the sample command, the only thing that’s muted is the microphone’s level in the “Playback” tab. I’ve tried several combinations, but none work: For example:

    nircmd mutesubunitvolume “Microphone” “Microphone” 2

    Since “Microphone” is the name of the device as well as the slider, but these are under the “Recording” tab.

    This command doesn’t error, but it also doesn’t do anything.

    Thanks

  6. Kendall Starr says:

    Daniel, in case you never got an answer:

    nircmd.exe mutesysvolume 2 microphone

    will toggle-mute the microphone. i had the reverse problem; i had already gotten the mic to mute, but had to come here to find out how to mute its playback. hopefully that helps you 🙂

  7. Juan says:

    i tried to create a shortcut and disable microphone because we want to switch on/off the microphone to record peoples speech, and its not working, the mic stills recording. (windows 7 ultimate x64)

    nircmd.exe mutesubunitvolume “Microphone” 2

  8. woeffie says:

    Will this also work for “Front” in case of 5.1 audio devices?
    Something in my computer sets the “front” volume to zero at every re-start…

  9. David says:

    Having same problem. I have been able to get other nircmd commands to work, but not the mute microphone on an XP or Win 7 x64 computer. Both are have an 5.1 audio device and no matter what wording I try, it never takes.

  10. Casey says:

    What I found for muting the mic on x64 Win 7 was that the PLAYBACK device associated with the mic has to be designated as the default device. Not that the target recording device does not need to be set as default. I made sure my mic recording device had a unique name. The following command works for me.

    nircmd.exe mutesysvolume 2 Realtek

  11. Dave H says:

    I confirm what Casey is saying. x64 Win 7.

    default playback device has to match mic input. which sucks because i want to use my speakers and not my mic’s monitor jack.

    i would love to see this work as intended.

  12. Leo says:

    I am using Win 7 x64 home pro

    the following command work well in command prompt but not work when I run in SSH termianl which run in the same user, any reason for this?

    nircmdc speak text Hello

  13. Leo says:

    I did try use both 32 & 64bit version of nircmdc, same result.

  14. NaX says:

    Excellent – could you add a parameter to select the default communication device?

  15. Paul B. says:

    Is there a way to Get the existing system volume level? I would use it in an If statement. Thanks.

  16. Andrew says:

    As woeffie asked, how to make this work for “Front”, “Rear”, “Center”, “Subwoofer” … in case of 5.1 or 7.1 audio devices?

  17. Thiima says:

    Thanks to Casey’s interpretation of the mutesysvolume command – the volume of the microphone can be changed with the command “changesysvolume 65535 Microphone”

  18. Greg Bott says:

    Awesome additions. Many thanks!!!

  19. «G~Lí†çh» says:

    Hm… why there is no comment with the link to SoundVolumeView?
    http://blog.nirsoft.net/2013/09/10/new-utility-to-control-the-sound-volume-on-windows-vista782008/

Leave a Reply