C# : start up an application on specific time

孤人 提交于 2021-02-16 14:20:16

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!