Click here to Skip to main content
15,917,808 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hello,
Can i run C# application automatically in specific time without make Debugging.
Posted
Comments
Sergey Alexandrovich Kryukov 23-Jul-13 15:30pm    
Not a question, not clear. Specific time between what and what? Anyway, http://www.whathaveyoutried.com?
—SA
loai_maane 23-Jul-13 15:37pm    
i finish my C# project but i want to run my project in specific time (such as 22:00:00)and close it in 23:00:00
Sergey Alexandrovich Kryukov 23-Jul-13 15:46pm    
First of all, why?
—SA
[no name] 23-Jul-13 15:32pm    
Yes
loai_maane 23-Jul-13 15:38pm    
there is any code to do this

Apparently, if you really want your application not started until some moment of time and then started, it cannot be implemented in this application itself.

Why not using existing service which is designed to support really complex schedules? It is already bundled with Windows and enabled; you can use it on different levels. It is called Window Task Scheduler, see http://en.wikipedia.org/wiki/Windows_Task_Scheduler[^].

First, you can schedule events using command-line utilities AT.EXE or CSHTASKS.EXE (which is replacing AT.EXE), see:
http://en.wikipedia.org/wiki/At_%28Windows%29[^],
http://en.wikipedia.org/wiki/Schtasks[^],
http://technet.microsoft.com/en-us/library/bb490866.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/bb736357%28v=vs.85%29.aspx[^].

And you also can use Window Task Scheduler API, please see:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383614%28v=vs.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383608%28v=vs.85%29.aspx[^].

To see how can you use it with .NET, see this CodeProject article: A New Task Scheduler Class Library for .NET[^].

—SA
 
Share this answer
 
Comments
ridoy 23-Jul-13 15:53pm    
SA,you make clear the problem to me rather than OP,:) +5
Sergey Alexandrovich Kryukov 23-Jul-13 16:01pm    
Thank you very much, hope OP will join you... :-)
—SA
You don't need any code to do this. You just setup a Scheduled Task (see Start -> All Program -> Administrative Tools -> Task Scheduler) to run your app on whatever schedule you want.
 
Share this answer
 

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