Turning on and off the TV using the USB-CEC Adapter or NUC-CEC adapter can be achieved by writing batch files calling this cec-client.exe.
To understand what batch files are, please go to this link = How to create a batch file
Create two batch files:
tv_on.bat = This one to turn TV on, or when TV is on an alternative source.
tv_off.bat = This one to turn TV off to standby.
The contents of the batch file are given below:
tv_on.bat
echo as | "C:\Program Files (x86)\Pulse-Eight\USB-CEC Adapter\cec-client.exe" -s -p 1
tv_off.bat
echo standby 0 | "C:\Program Files (x86)\Pulse-Eight\USB-CEC Adapter\cec-client.exe" -s -p 1
Please note:
The above batch file commands are assuming you have installed cec-client in C:\Program Files (x86)\Pulse-Eight\USB-CEC Adapter\. If not please enter the correct directory.
The last argument "1" signifies the HDMI port of the TV. If you have connected to HDMI port 3 (for example) the arguments are -s -p 3
Startup:
To turn the TV on using USB-CEC Adapter during PC startup, please save tv_on.bat file in the Startup folder. It is usually located in:
C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Shutdown:
To turn the TV off during shutdown, please add a shutdown command(shown below) to tv_off.bat and run this batch file to shutdown your PC.
shutdown -s -t 5
Where the "5" signifies the number of seconds to wait before shutting down. You can adjust this number to your convenience.