Windows计划任务和控制台应用程序

Windows计划任务和控制台应用程序

本文介绍了Windows计划任务和控制台应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我创建一个简单的工作,我想运行每60秒(1分钟)。而不是使用Windows服务安装程序接近这一点,我想创建一个通过Windows调度程序运行的控制台应用程序。I'm creating a simple job that I'd like to run every 60 seconds (1 minute). Instead of approaching this using a Windows Service Installer program, I'd like to create a Console App that is run through Windows Scheduler.如果工作启动,处理时间超过60秒,会发生什么情况?工作的第二个例子会再次开始吗?我希望Windows以一种方式管理作业,这样一个作业的第二个实例将不会启动,直到第一个完成。What will happen if a job kicks off and it takes more than 60 seconds to process? Will a second instance of a job kick off again? I'd like Windows to manage the job in a manner such that a second instance of a job won't kick off until the first one is complete.感? Windows任务计划程序会默认使用这种方法吗?Does this make sense? Will the Windows Task Scheduler use this approach by default?感谢所有。推荐答案是的,Windows将默认启动一个新实例;但是,您可以控制此行为。在控制面板中,转到任务计划程序。查找任何时间计划任务,右键单击/属性,然后选择设置选项卡。在底部,您会看到一个名为如果任务已在运行,则应用以下规则的选项。您可以选择不启动新实例,并行运行新实例,对新实例排队,或停止现有实例。你想要的第一选择。 Windows任务计划程序API 提供相同的功能。Yes, Windows will start a new instance by default; however, you can control that behavior. In Control Panel, go to Task Scheduler. Find any time-scheduled task and right click/Properties, then choose the Settings tab. At the bottom, you'll see an option named "If the task is already running, then the following rule applies." You can choose to not start a new instance, run a new instance in parallel, queue a new instance, or stop the existing instance. You want the first choice. The Windows Task Scheduler API provides the same functionality. 这篇关于Windows计划任务和控制台应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-24 00:30