windows-7 - Windows 7 是否支持 ITaskScheduler?

标签 windows-7 scheduled-tasks task windows-7-x64

ITaskScheduler 在 Windows 7 中支持?

我在 Windows XP 和 Windows Vista 中使用了任务计划程序来创建计划任务。

在 Windows 7 上,作业被(正确)创建,例如:

C:\Windows\Tasks\Foo Test Task.job

但任务永远不会运行,也不会出现在任务计划程序 UI(开始 -> 任务计划程序)中:

enter image description here

注:根据 MSDN,ITaskScheduler是现已弃用的 的一部分任务调度程序 1.0 API .新应用程序应使用 ITaskService 的一部分任务计划程序 2.0 .

由于ITaskScheduler在 Windows 7 下不起作用(对我来说)(但在 Windows Vista 下确实起作用)我想知道它是否不再受支持(即使 COM 对象存在,代码不会导致错误,它会创建作业)。

虽然 MSDN 不包括 window 7 在 Task Scheduler 1.0 支持的操作系统列表中,它甚至没有说 Windows 7 支持 Task Scheduler 2.0:

Run-Time Requirements

The Task Scheduler requires the following operating systems.

  • Task Scheduler 1.0: Client requires Windows Vista, Windows XP, Windows 2000 Professional, Windows Me, or Windows 98. Server requires Windows Server 2008, Windows Server 2003 or Windows 2000 Server.
  • Task Scheduler 2.0: Client requires Windows Vista. Server requires Windows Server 2008.


所以官方在 Windows 7 上不支持任务调度程序 API。

但是是ITaskScheduler在 Windows 7 上支持?

预计会起作用吗?

从社区对 Task Scheduler homepage 的评论来看, 我猜不会:

Task Scheduler 1.0 under Windows Vista, Windows 7 etc.
Is it really possible to use Task Scheduler 1,0 under Windows Vista and Windows 7? How can it be done?

Task Scheduler work-around for Win7
I have the same trouble with Win7 Task Scheduler - Creating a simple task to launch a script/program does not work.

I exported my non-working task as well as a working MS task and compared them. I changed the following parameter in my exported task and re-imported it and now it works: <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>

This work-around is getting me by for now.

Other thoughts: There does not appear to be a Task Scheduler GUI setting to affect this parameter? The API description implied a setting of false should work, but for some reason it doesn't? It's hard to believe such a fundemental overshight exists; could it be something else with my Win7 setup that requires the true setting? I seem to recall the same problem with a fresh Vista install in the past that was mysteriously resolved before I investigated a work-around. Hmmm... I think I read also that the new scheduling engine associated with the true setting curiously does not support things like monthly scheduling....?

Task Schedule in Windows 7 fails but works in Windows XP Pro
I have a scheduled task that executes perfectly well in Windows XP Pro but the same task in Windows 7 returns a "0x2" under "Last Run Result". According to the command line command, "net helpmsg 2", "0x2" equates to "The system cannot find the file specified."

I can certainly find the file, and the path I use in the Actions tab has been checked, re-checked, double-checked and triple-checked.

I have read countless posts in multiple forums about this issue. I have yet to find a satisfactory answer.

The action that the task is supposed to execute is a .bat file that calls a Perl script. The Perl script writes one each of the following file types, .txt, .csv, and .xml. Execution of the .bat file from the command line works perfectly well; however, once it is put into a Windows 7 scheduled task, it returns 0x2. This same task under Windows XP Pro works like a champ. What is it about Windows 7 tasks that make it so difficult to execute successfully?

最佳答案

在 Vista 之后您需要使用 Task Scheduler 2.0 界面而不是 1.0。部分可以处理 w7 旧调度程序应用程序,但之间存在很多差异。

如果你需要创建一个跨平台(xp/vista/w7/w8)的调度器,你需要处理操作系统版本和接口(interface)。很多额外的工作,但比使用旧界面创建一个解决方案要好。

关于windows-7 - Windows 7 是否支持 ITaskScheduler?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6022305/

相关文章:

c# - 秒表与 Task.Wait

c# - 多少任务太多了?

windows-7 - ubuntu CLI 的 vmware 窗口大小

c++ - WinbioOpensession 返回 E_ACCESSDENIED?

triggers - Windows 任务计划程序错误地为每个触发器生成多个实例(但需要能够并行运行多个实例)

iOS 后台任务未完成

windows - 在哪里可以找到 Windows 应用程序的用户界面 (UI) 设计模式?

linux - Docker 命令在 Windows 7 上不可用

c# - 如何创建调度程序(例如安排推文或 api 请求)

linux - rundeck:辅助 sudo 密码身份验证不起作用