I have two audio devices and use a bat file with 'nircmd' to change what audio device (and monitor) to use as default. This so I can change from TV (AV Receiver over HDMI) to Monitor (Mainboard Audio device).


nircmdc.exe setdefaultsounddevice "DENON-AVRHD"

Until recently this worked fine but the last couple of weeks Windows keep changing the name of the device, required by nircmd, and I have to change it manually. For instance it changes to: DENON-AVRHD-4 DENON-AVRHD-8 DENON-AVRHD-C

Here's an image of my current devices:

Audio Devices

"Speakers" are always the same but the Denon AVR keeps changing almost every boot. I am not sure what has caused this change, possibly drivers (NVIDIA HD Audio) or the recent Windows update.

Is there any way to stop this from happening?

  • You get use wmic sounddev get name | findstr "DENON" to get the current name. Use the output from this in your batch file. – DavidPostill Feb 14 '16 at 20:18
  • @DavidPostill - Thanks for the tip, it seemed very promising. Unfortunately the "Device Name" listed by wmic is "NVIDIA High Definition Audio" but this device can have several playback devices attached (HDMI). The findstr just returns a blank. Is there a way to get the same list as in the playback devices? – Stian Lund Feb 14 '16 at 20:35
  • Ah. OK try using the Powershell Windows Audio Device Cmdlet: it has Get-AudioDeviceList – DavidPostill Feb 14 '16 at 20:59
  • @DavidPostill Thanks, that does seem to work, using powershell Set-DefaultAudioDevice 2 in the bat file. Also had a look at another alternative 'AudioSwitch' (github.com/sirWest/AudioSwitch) since it supports cmd switches. I contacted the author of Nircmd, possibly he can change it to use indexes instead of name strings. – Stian Lund Feb 14 '16 at 21:44
  • Great. Now you can answer your own question. ;) – DavidPostill Feb 14 '16 at 21:46

Ok, after some research I've found the reason for the renaming of the audio devices. I had recently connected a new monitor over DisplayPort, and for them to be "Energy Star" compliant, newer monitors have a "deep sleep" feature which makes the computer thing the monitor is disconnected.

When I restarted the computer with the monitor turned off, this forced the display adapter to reconfigure the attached devices, including HDMI/DP audio devices connected to the display adapter. Basically, they were reinstalled and got a new name every time this happened.

Since the devices were reinstalled there was no way to rely on Display ID or index of the devices to change them in a command line, although I could probably use some advanced scripting to use the correct name every time.

The solution was to go into the monitor setup and disable "Deep Sleep" as Asus calls it. This should (hopefully) stop this from happening too often.

See also this answer: https://superuser.com/a/631853/18736

| improve this answer | |

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.