2
我想写一个将调用我的已安装应用程序的石英作业。使用石英作业调用应用程序
比如我有控制台应用程序:
class Program
{
static void Main(string[] args)
{
Console.WriteLine(Datetime.Now());
Console.ReadLine();
}
}
和发布我的Windows机器上这个程序。现在我写这个代码:
class Program
{
static void Main(string[] args)
{
var schedFact = new StdSchedulerFactory();
var sched = schedFact.GetScheduler();
sched.Start();
var job = JobBuilder.Create<TestJob>()
.WithIdentity("testjob", "testgroup")
.Build();
var trigger = TriggerBuilder.Create()
.WithIdentity("testtrigger", "testgroup")
.WithSimpleSchedule(x => x.WithIntervalInMinutes(1).RepeatForever())
.Build();
sched.ScheduleJob(job, trigger);
}
}
public class TestJob : IJob
{
public void Execute(IJobExecutionContext context)
{
// Here I want to call my app
}
}
我该怎么做?
使用的Process.Start并添加参数,你的第一个控制台EXE – Paul