本文介绍了Windows任务计划程序安装程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小的.exe写在C#.net,我想在服务器上,每24小时运行。所以很自然,我只想使用Windows任务程序器而不是做数学我自己。我已创建的程序,但我想创建一个只设置好一切的安装程序。有没有一种方法来与像Visual Studio中建立的项目做到这一点?如果不是有这样的可以用来安装后运行一个PowerShell /批处理脚本?

I have a little .exe written in c# .net that I want to run on the server every 24 hours. So naturally I would just use the Windows Task Schedular rather then doing the math myself. I have created the program, but I would like to create an installer that just set everything up. Is there a way to do this with like the Visual Studio set-up projects? If not is there like a powershell / batch script that could be used to run after installation?

底线:自动创建任务

推荐答案

您可以使用PowerShell脚本或批处理文件来执行的这是一个命令行界面的任务调度。

You can use a powershell script or batch file to execute schtasks which is a command line interface to the task scheduler.

然后你只需要才能运行脚本设置计划任务。

Then you simply need to run the script in order to setup the scheduled task.

还有一个托管包装,使您可以用C#创建计划任务,如果你宁愿走那条路。

There is also a managed wrapper that allows you to create schedules tasks in C#, if you would rather go that way.

这篇关于Windows任务计划程序安装程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 06:29