Powershell – Setting playback device by executing a batch file / powershell script


I've got my computer(Windows 7) hooked up to the TV, and i very often change output device for sound between Digital Audio (S/PDIF)(High definition audio device) and my headset (2- Corsair CA-HS1 USB Headset)

I wanna be able to execute a batch/script file who changes this for me so i don't have to "right click volume > playback devices > "Mark output device" and click "set default".

I know it's a luxury problem, but hey, maybe I can learn something from someone?

All help appreciated!

Best Solution

This is how I set 'Line 1' as the playback device:

start /min "" G:\......\nircmd.exe setdefaultsounddevice "Line 1"

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