CEC Adapter — Turn Your TV On Automatically at Windows Logon Using Task Scheduler

Modified on Fri, 1 May at 1:59 PM

This article explains how to use Windows Task Scheduler to automatically turn your TV on when a user logs into Windows, using the tv_on command included with libcec.

Before you start — test the command manually first.
The batch file must work correctly when run manually before adding it to Task Scheduler. If it does not work when run by hand, it will not work when triggered at logon. Confirm the tv_on command turns your TV on successfully before proceeding.
The tv_on batch file can be found at C:\Program Files\Pulse-Eight\USB-CEC Adapter
Why does Task Scheduler sometimes fail even when the batch file works manually?
When Windows triggers a task at logon, it fires very early in the session — often before the HDMI handshake between the PC and TV has fully completed. libcec needs the HDMI link to be active before it can send a CEC command. If the command runs too early, it finds no display and fails silently. The solution is to add a short delay, giving Windows time to establish the HDMI connection before the command fires. This article includes that delay in the setup.

Which HDMI Port Are You Using?

libcec will attempt to detect the correct HDMI port automatically. If your TV switches to the wrong input, you will need to specify the port number manually. To do this, add -s -p X to the end of the command, where X is the HDMI port number the CEC adapter is connected to — for example -s -p 3 for HDMI port 3.

If you are unsure which port is correct, try the automatic detection first and only add the port flag if the TV switches to the wrong input.


Step 1 — Locate the tv_on Command

1
Open File Explorer and navigate to the libcec installation folder. This is usually one of:
C:\Program Files\Pulse-Eight\USB-CEC Adapter
or
C:\Program Files (x86)\Pulse-Eight\USB-CEC Adapter
2
Locate the tv_on batch file in this folder.
3
Double-click the tv_on batch file to run it manually and confirm your TV turns on. If it does not work at this stage, do not continue — resolve this first. See How to install libcec (Windows) if needed.

Step 2 — Open Task Scheduler

1
Click the Windows Start button, type Task Scheduler, and open the program.
2
In the left panel, click Task Scheduler Library.
3
In the right panel, click Create Task.
4
In the General tab, give the task a name — for example: Turn TV on at logon. Add a description if you wish.

Step 3 — Set the Trigger

1
Click the Triggers tab, then click New... at the bottom.
2
In the Begin the task dropdown, select At log on.
3
Choose whether to trigger for Any user or a Specific user. By default the specific user will be whoever is currently logged in. To set a different user, click Change User... and use the Advanced search to find the correct Windows user account.
4
Important — set a delay. In the Advanced settings section at the bottom of the trigger window, tick Delay task for and set the delay to 30 seconds. This gives Windows time to fully establish the HDMI connection before the command fires.

If 30 seconds is too long for your preference, try 15 seconds first. If the TV still does not turn on reliably, increase to 30 seconds. The delay only affects how quickly the TV turns on after login — it does not affect Windows itself.
5
Click OK.

Step 4 — Set the Action

1
Click the Actions tab, then click New....
2
The action should already show Start a program — leave this as-is.
3
Click Browse... next to the Program/script field.
4
Navigate to the libcec installation folder and select the tv_on batch file. Click Open. The path will populate into the Program/script field.
5
If you need to specify an HDMI port, add -s -p X (replacing X with your port number) into the Add arguments (optional) field.
6
Click OK.

Step 5 — Finalise and Test

1
Click OK at the bottom of the Create Task window to save the task. You should now see it listed in the Task Scheduler Library.
2
To test, sign out of Windows and sign back in as the user the task is set for. After the delay you configured, the TV should turn on automatically.
3
If the TV does not turn on, right-click the task in Task Scheduler and select Run to trigger it immediately. If it works when manually triggered from Task Scheduler but not at logon, increase the delay in the trigger settings.

If Task Scheduler Is Not Right for Your Setup

Alternative: CEC-Tray (recommended for most users)

CEC-Tray runs as a background application and waits for the HDMI connection to be fully ready before sending commands, making it more reliable than a fixed delay. If you are finding the Task Scheduler approach inconsistent, CEC-Tray is the recommended alternative.

CEC Adapter — How to turn your TV on when your Windows 11 PC boots using CEC-Tray

Still having issues? Contact Pulse-Eight support with a description of what happens when the task fires and whether the tv_on command works when run manually.

Email: cs@pulse-eight.com  |  Submit a support ticket

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article