Important: This documentation has not quite caught up with the new release (SetDefaultAudioEndpoint-2011-03-15).
can change the default audio endpoint on a Windows system. An audio endpoint is an audio device attached to the system. Audio devices are used for both playback and recording.
can change the default playback device and the default recording device.
To change the default playback device, from a command prompt or with a scripting language, enter
SetDefaultAudioEndpoint.exe -p"Playback Device Name"
where Playback Device Name
is the name of an audio device on the Playback tab of the Sound control panel.
To change the default recording device, from a command prompt or with a scripting language, enter
SetDefaultAudioEndpoint.exe -r"Recording Device Name"
where Recording Device Name
is the name of an audio device on the Recording tab of the Sound control panel.
To access the Sound control panel, search for "Manage audio devices" from the Windows 7 start orb.
uses the Windows 7 Sound control panel window to make changes. The Sound control panel window is used because Microsoft has not officially sanctioned any other programmatic means to make this change.
If the Sound control panel window is open when SetDefaultAudioEndpoint
executes, the window will remain open after execution completes. Otherwise, the window will be closed.
If the operation completes successfully, text similar to the following is returned to the console: "The default audio playback device was set to 'Speakers'."
will return an error under any of the following circumstances:
- The audio device name cannot be found. In this case, a list of audio devices is returned to the console.
- The audio device cannot be set as the default audio endpoint. This can happen if the device is already the default audio endpoint.
- The Sound control panel window could not be opened. This can happen if there is other activity on your system when
SetDefaultAudioEndpoint is executing. Increase the value TryFindSoundWindowTimeoutMilliseconds in the file
bin\SetDefaultAudioEndpoint.exe.config if this problem persists. (The default value is 5001 milliseconds, or 5 seconds.)
Text describing the error is returned to the console.