windows 如何找到计划任务文件夹的位置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2913816/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 07:20:38  来源:igfitidea点击:

How to find the location of the Scheduled Tasks folder

windowsscheduled-tasks

提问by JoelFan

I have seen references online that state that 'Scheduled Tasks' in Windows are stored in %SystemRoot%\Tasks, which I think usually equates to C:\Windows\Tasks.

我已经在网上看到引用该状态在Windows的“任务计划”被存储在%SystemRoot%\Tasks,我认为通常等同于C:\Windows\Tasks

However, I observe that while that folder exists on my Windows 7 system, Scheduled tasks doesn't use it.

但是,我观察到虽然该文件夹存在于我的 Windows 7 系统上,但计划任务不使用它。

My system appears to use, C:\Windows\System32\Tasks.

我的系统似乎使用,C:\Windows\System32\Tasks.

I have studied the Environment variables and there doesn't seem to be anything related to Scheduled Tasksthere.

我研究了环境变量,似乎没有任何相关的东西Scheduled Tasks

How do I discover which folder is used for Scheduled tasks?

如何发现哪个文件夹用于计划任务?

回答by Jan

Tasks are saved in filesystem AND registry

任务保存在文件系统和注册表中

Tasks are stored in 3 locations: 1 file system location and 2 registry locations.

任务存储在 3 个位置:1 个文件系统位置和 2 个注册表位置。

File system:

文件系统:

C:\Windows\System32\Tasks

Registry:

注册表:

HKLM\Software\Microsoft\Windows NT\CurrentVersion\Schedule\Taskcache\Tasks
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Schedule\Taskcache\Tree

So, you need to delete a corrupted task in these 3 locations.

因此,您需要在这 3 个位置删除损坏的任务。

回答by CR0SS0V3R

For Windows 7 and up, scheduled tasks are not run by cmd.exe, but rather by MMC(Microsoft Management Console). %SystemRoot%\Tasksshould work on any other Windows version though.

对于 Windows 7 及更高版本,计划任务不是由 运行cmd.exe,而是由MMC(Microsoft 管理控制台)运行。%SystemRoot%\Tasks不过应该适用于任何其他 Windows 版本。

回答by gek0n

I want to extend @Jan answer:

我想扩展@Jan 的回答:

It's seems, that Task Scheduler 1.0 APIuses C:\Windows\Tasksfolder for create and enumerate tasks (this example), while Task Scheduler 2.0 APIuses C:\Windows\System32\Tasksto create and enumerate tasks (this example).

它似乎是Task Scheduler 1.0 API使用C:\Windows\Tasks文件夹的创建和枚举任务(这个例子),而Task Scheduler 2.0 API使用C:\Windows\System32\Tasks创建并列举任务(这个例子)。

It's also seems, that windows console utilite schtasksand GUI utilite taskschd.mscuses Task Scheduler 2.0 API.

似乎 Windows 控制台实用程序schtasks和 GUI 实用程序taskschd.msc使用Task Scheduler 2.0 API.

P.S. I found, that if task placed in C:\Windows\Tasksand have notsetted AccountInformation, then task won't be displayedin windows console and gui schedulers. If you setAccountInformation(even "" for SYSTEM account) and setflag TASK_FLAG_RUN_ONLY_IF_LOGGED_ON- task will bedisplayed in all standart applications.

PS我发现,如果任务放置在C:\Windows\Tasks没有设置AccountInformation,那么任务将不会显示在windows控制台和gui调度程序中。如果您设置AccountInformation(甚至为系统帐户设置“”)并设置标志TASK_FLAG_RUN_ONLY_IF_LOGGED_ON- 任务显示在所有标准应用程序中。

Solution found here

解决方案在这里找到

回答by B. Hill

There are multiple issues with the MMC however as on almost every PC in my business the ask scheduler API will not open and has somehow been corrupted. So you cannot edit, delete or otherwise modify tasks that were developed before the API decided not to run anymore. The only way we have found to fix that issue is to totally wipe away a persons profile under the C:\Users\ area and force the system to recreate the log in once the person logs back in. This seems to fix the API issue and it works again, however the tasks are often not visible anymore to that user since the tasks developed are specific to the user and not the machine in Windows 7. The other odd thing is that sometimes, although not with any frequency that can be analyzed, the tasks still run even though the API is corrupted and will not open. The cause of this issue is apparently not known but there are many "fixes" described on various websites, but the user profile deletion and adding anew seems to work every time for at least a little while. The tasks are saved as XML now in WIN 7, so if you do find them in the system32/tasks folder you can delete them, or copy them to a new drive and then import them back into task scheduler. We went with the system scheduler software from Splinterware though since we had the same corruption issue multiple times even with the fix that does not seem to be permanent.

MMC 存在多个问题,但是在我公司的几乎每台 PC 上,ask 调度程序 API 都无法打开,并且以某种方式已损坏。因此,您无法编辑、删除或以其他方式修改在 API 决定不再运行之前开发的任务。我们发现解决该问题的唯一方法是完全擦除 C:\Users\ 区域下的个人资料,并在该人重新登录后强制系统重新登录。这似乎解决了 API 问题,并且它再次工作,但是任务通常不再对该用户可见,因为开发的任务特定于用户而不是 Windows 7 中的机器。 另一个奇怪的是,有时,虽然没有任何可以分析的频率,即使 API 已损坏且无法打开,任务仍会运行。此问题的原因显然未知,但在各种网站上描述了许多“修复”,但删除和重新添加用户配置文件似乎每次都至少工作一段时间。任务现在在 WIN 7 中保存为 XML,因此如果您在 system32/tasks 文件夹中找到它们,您可以删除它们,或将它们复制到新驱动器,然后将它们导入回任务计划程序。我们使用了 Splinterware 的系统调度程序软件,因为即使修复似乎不是永久性的,我们也多次遇到相同的损坏问题。因此,如果您确实在 system32/tasks 文件夹中找到了它们,您可以删除它们,或将它们复制到新驱动器,然后将它们重新导入任务计划程序。我们使用了 Splinterware 的系统调度程序软件,因为即使修复似乎不是永久性的,我们也多次遇到相同的损坏问题。因此,如果您确实在 system32/tasks 文件夹中找到了它们,您可以删除它们,或将它们复制到新驱动器,然后将它们重新导入任务计划程序。我们使用了 Splinterware 的系统调度程序软件,因为即使修复似乎不是永久性的,我们也多次遇到相同的损坏问题。

回答by Peter Krantz

Looks like TaskCache registry data is in ...

看起来 TaskCache 注册表数据在...

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache

... on my Windows 10 PC (i.e. add Schedulebefore TaskCacheand TaskCache has an upper case C).

...在我的 Windows 10 PC 上(即在TaskCache和 Task Cache之前添加Schedule有一个大写C)。

回答by TechnoTim

On newer versions of Windows (Windows 10 and Windows Server 2016) the tasks you create are located in C:\Windows\Tasks. They will have the extension .job

在较新版本的 Windows(Windows 10 和 Windows Server 2016)上,您创建的任务位于C:\Windows\Tasks. 他们将有扩展.job

For example if you create the task "DoWork" it will create the task in

例如,如果您创建任务“DoWork”,它将在

C:\Windows\Tasks\DoWork.job