I'm helping a user with a personal Windows 11 computer which, in addition to the built-in monitor, is connected via HDMI to a shared/public television display.
When it comes time to stream a show or movie to the larger display, the following two operations must occur:
- Start > Settings > System > Sound > Output > Select correct device from dropdown list.
- Start > Settings > System > Display > Set display mode to "Extend" > Confirm changes.
Then, when steaming time is over, the Sound and Display settings must be set back to the more private configuration:
- Start > Settings > System > Sound > Output > Select built-in monitor from dropdown list.
- Start > Settings > System > Display > Set display mode to "Duplicate" > Confirm changes.
This "works" in that it produces the desired outcome, but is not "workable" for the non-technical user, given the number of touch points and values to remember. What would be great would be a pair of functionally equivalent scripts (one for each workflow) that I could link to as Desktop shortcuts.
Assuming full administrator access, is such a thing possible? Is there any API documentation I should be searching?
For display devices, Windows comes with a built-in command-line program
displayswitch.exe(though do note that Windows 10 and Windows 11 have different, and incompatible, command-line options).For audio output, Windows doesn't seem to have a built-in command-line program nor PowerShell cmdlet, but NirSoft provides a reputable command-line program:
nircmd setdefaultsounddevice.So combine the two:
Start Streaming.cmd
Stop Streaming.cmd