YZlat
asked on
How can I use a timer to schedule exe to run at a specific time
I have a windows service that retrieves date and time from the database and then needs to schedule exe to run at that time. Can someone help?
Have you tried to create a scheduled task for the exe?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
idle_mind, what is Schedule in this case?
It's at line #1, and is a Dictionary to associate the string path to the EXE with each Timer instance so you can look it up when the Elapsed() event fires.
ASKER
I tried your code and it seemed to do nothing. So I che4cked the Task manager and saw that the process for the exe was running but the user form didn't show up. My exe is a Windows application
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Can I add a windows form to my windows service and run that form instead of an exe?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks.
One more thing, if I replace my Windows service with exe, how can make it run every hour programmatically? I want to schedule it either via code or via setup project i use to install it. Is there a way to do that?
One more thing, if I replace my Windows service with exe, how can make it run every hour programmatically? I want to schedule it either via code or via setup project i use to install it. Is there a way to do that?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I tried to schedule the task using Windows scheduler but there is no option for hourly, just daily
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Can this be done programmatically?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you, I will check it out