Zend certified PHP/Magento developer

Display switch with a timeout

I have my PC connected to my monitor and TV. I want to be able to switch my display to the TV and launch an application through a script.

As I do this, I would like to set the audio to be the TV output.

I want to add a timeout between switching display and starting the application / switching the audio, to give the display switch adequate time to complete.

Here is my bat file:

@echo off
DisplaySwitch.exe 4

timeout /T 5

nircmd setdefaultsounddevice "TV" 1

<path to application>

However, when I have the display switch command, it seems like the timeout is not being respected before launching the application. Without the display switch command, a 5 second sleep happens before the application is launched.

I am open to any other solutions