Win+p -> Duplicate by shortcut or CLI command?


I'm trying to make an easy way to put my computer in and out of a TV-mode, where the TV will be attached as a secondary monitor in clone mode when in the TV-mode, and detached when out of the TV-mode. To do this, I need a command/shortcut that does exactly what happens when you press Win+p and select "Duplicate". Is there any way to achieve this?

I appreciate any help or tips regarding this, thanks!

This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.