执行Windows调度程序的C#应用​​程序 [英] Execute C# application for windows scheduler

查看:77
本文介绍了执行Windows调度程序的C#应用​​程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我构建了一个小应用程序来读取文本文件并编写一个新文件。我现在需要做的是使用Windows调度程序安排应用程序并在特定时间自动运行它。我从哪里开始,所以应用程序可以自行运行?我还读到我需要参数?它是一个WinForm应用程序,所以我有一个按钮需要点击才能运行整个过程。



我尝试过:



I have built a small application that reads text files and writes a new one. What I need to do now is schedule the application with windows scheduler and run it automatically at a certain time. Where do I start so application can run by itself? I have also read that I need arguments? It is a WinForm application so I have one button that needs to be clicked for the whole process to run.

What I have tried:

static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new DataReader());
        }





据我所知,这是列出所有参数以获取应用程序的地方。



As far as I know this is where you list all the arguments to get the application going.

推荐答案

将其更改为由调度程序运行的控制台应用程序(无按钮 - 只需执行此操作)或将其设置为Windows服务。

您可以使用命令行参数或配置文件等。试一试,如果您遇到特定问题请告诉我们



- 您可能会有一些文章找到有用的:

C#/ .NET命令行参数解析器 [ ^ ]

强大C#中的简单命令行解析 [ ^ ]

(还有其他几个 - 搜索命令行解析在本页顶部的搜索框中)

另外:

在C#中创建基本Windows服务 [ ^ ]

简单的Windows服务示例 [ ^ ]

再次 - 关于主题的代码项目还有更多文章
Change it to be a console application run by the scheduler (no button - just do it) or set it up as a windows service.
You can use command line arguments or configuration files, etc. Give something a try and let us know if you have a specific problem

- Some articles you may find useful:
C#/.NET Command Line Arguments Parser[^]
Powerful and simple command line parsing in C#[^]
(There are several others - search for Command Line Parse in the search box at the top of this page)
Also:
Creating a Basic Windows Service in C#[^]
Simple Windows Service Sample[^]
Again - there are lots more articles here on Code Project on the subject


这篇关于执行Windows调度程序的C#应用​​程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆