问题
i`d like to start an application on specific time on computer , how to do it in c# ? , simply i am working on application that the user will set a timer when the application has to run and do a specific task , i heard that in windows there is a tool that can be used to start an application on specific time .
回答1:
Yes, Windows has a built-in scheduler and .net has class to manipulate it programmatically.
You can find an example on codeproject.com.
回答2:
You can use the windows "at" command. You will need to run the command prompt with administration permissions to do this.
Here is the command help:
The AT command schedules commands and programs to run on a computer at a specified time and date. The Schedule service must be running to use the AT command.
AT [\computername] [ [id] [/DELETE] | /DELETE [/YES]] AT [\computername] time [/INTERACTIVE] [ /EVERY:date[,...] | /NEXT:date[,...]] "command"
回答3:
You can use Timer.
it needs time in milliseconds to start. You can calculate that by comparing the current time and the time you want your application to start at.
and set resetAuto property of a timer according to you need.
来源:https://stackoverflow.com/questions/7958314/c-sharp-start-up-an-application-on-specific-time