Turning on and off the TV using the USB-CEC Adapter or NUC-CEC adapter can be achieved by calling batch files that can be found in the installation folder of libCEC.
libCEC can be downloaded from Github: libcec-6.0.0.exe
The batch files will be installed in the folder C:\Program Files (x86)\Pulse-Eight\USB-CEC Adapter\ by default.
tv_on.cmd
Call this script to send a power on command to the TV.
tv_off.cmd
Call this script to send a power off command to the TV.
Please note:
These scripts assume that the HDMI port number can either be detected automatically by libCEC or that HDMI port 1 of the TV is used. If the TV switches to the wrong input, you'll have to edit these files.
If you have connected to HDMI port 3 (for example), add the following to the last line of the script -s -p 3
The last number indicates which HDMI port is used.
Startup:
To turn the TV on using USB-CEC Adapter during PC startup, please save tv_on.cmd 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.cmd 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.