Click here to Skip to main content
15,665,276 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Just to give a little background as someone may have a better idea. I developed a program that displays photos in fullscreen. It cycles through files in a folder that our Marketing team populates. The program then runs on a TV's through our many location. The program is on a network location. Occasionaly if the network goes down or the wifi becomes slow the program stops working as it can't pull the images.

So I have a .bat file that stops a program, then starts it backup.
taskkill /f /im tvs.exe
Echo "Restarting TV Program"
START C:\Users\rise\Desktop\TVApplication.lnk

I have created a Task Scheduler with the following properties:
Run on login
Delay for 2 Minutes
Repeat Every 4 Hours
Action is start the batch file

When I restart the computer. It runs the .bat file but the START action never start the program. If I run the .bat file manually without the Scheduler it runs just fine. After I run it manually once, when the task scheduler runs after 4 hours it works perfect.

So the only issue that Im running into is that when the computer boots up, the START program part of the .bat file never works properly.

What I have tried:

If I right click on the schedule and do a Run, the Start Action doesn't happen.

I changed the repeat every from 4 hours to 5 minutes. I let it run for 4-5 times and the START program never happens.

It only runs correctly if I run the .bat file first, then the repeats in the schedule work fine.
Updated 13-May-21 6:41am

Your TVS app needs better error handling and recovery code, not a restart like this.
Share this answer
If you have a .NET application you might be interested in Hangfire[^]

The only thing I can say about your batch file is that the TIMEOUT command might cause problems, I remember that we always had problems with it when trying to run unattended batch files, so we replaced it by a PING command which takes some time too.
Share this answer
Cody O'Meara 13-May-21 12:21pm    
Thank you for the response! Tried it and unfortunately it results in the same thing.

I will definitely check out Hangfire!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900