如何查找计划任务文件夹的位置
我在网上看到参考文献指出 Windows 中的“计划任务”存储在 %SystemRoot%\Tasks
中,我认为它通常等同于 C:\Windows\Tasks
。
但是,我发现虽然该文件夹存在于我的 Windows 7 系统上,但计划任务并不使用它。
我的系统似乎使用C:\Windows\System32\Tasks
。
我研究了环境变量,那里似乎没有任何与计划任务
相关的内容。
如何发现哪个文件夹用于计划任务?
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
.
However, I observe that while that folder exists on my Windows 7 system, Scheduled tasks doesn't use it.
My system appears to use, C:\Windows\System32\Tasks
.
I have studied the Environment variables and there doesn't seem to be anything related to Scheduled Tasks
there.
How do I discover which folder is used for Scheduled tasks?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
任务保存在文件系统和注册表中 任务
存储在 3 个位置:1 个文件系统位置和 2 个注册表位置。
文件系统:
注册表:
因此,您需要删除这 3 个位置中损坏的任务。
Tasks are saved in filesystem AND registry
Tasks are stored in 3 locations: 1 file system location and 2 registry locations.
File system:
Registry:
So, you need to delete a corrupted task in these 3 locations.
我想扩展@Jan 的答案:
看来,
Task Scheduler 1.0 API
使用C:\Windows\Tasks
文件夹来创建和枚举任务(此示例),而任务计划程序2.0 API
使用C:\Windows\System32\Tasks
创建和枚举任务 (此示例)。Windows 控制台实用程序
schtasks
和 GUI 实用程序taskschd.msc
似乎也使用Task Scheduler 2.0 API
。聚苯乙烯
我发现,如果任务放置在
C:\Windows\Tasks
中并且没有设置AccountInformation
,那么任务将不会显示在 Windows 控制台和 GUI 调度程序中。如果您设置AccountInformation
(对于系统帐户甚至为“”)并设置标志TASK_FLAG_RUN_ONLY_IF_LOGGED_ON
- 任务将被显示在所有标准应用程序中。在这里找到解决方案
I want to extend @Jan answer:
It's seems, that
Task Scheduler 1.0 API
usesC:\Windows\Tasks
folder for create and enumerate tasks (this example), whileTask Scheduler 2.0 API
usesC:\Windows\System32\Tasks
to create and enumerate tasks (this example).It's also seems, that windows console utility
schtasks
and GUI utilitytaskschd.msc
usesTask Scheduler 2.0 API
.P.S.
I found, that if task placed in
C:\Windows\Tasks
and have not setAccountInformation
, then task won't be displayed in windows console and GUI schedulers. If you setAccountInformation
(even "" for SYSTEM account) and set flagTASK_FLAG_RUN_ONLY_IF_LOGGED_ON
- task will be displayed in all standard applications.Solution found here
对于 Windows 7 及更高版本,计划任务不是由
cmd.exe
运行,而是由MMC
(Microsoft 管理控制台)运行。不过,%SystemRoot%\Tasks
应该适用于任何其他 Windows 版本。For Windows 7 and up, scheduled tasks are not run by
cmd.exe
, but rather byMMC
(Microsoft Management Console).%SystemRoot%\Tasks
should work on any other Windows version though.看起来 TaskCache 注册表数据位于 ...
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache
... 在我的 Windows 10 PC 上(即添加 Schedule在 TaskCache 和 TaskCache 之前有一个大写的 C)。
Looks like TaskCache registry data is in ...
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache
... on my Windows 10 PC (i.e. add Schedule before TaskCache and TaskCache has an upper case C).
MMC 存在多个问题,但在我公司的几乎每台 PC 上,询问调度程序 API 都无法打开并且已以某种方式损坏。因此,您无法编辑、删除或以其他方式修改在 API 决定不再运行之前开发的任务。我们发现解决该问题的唯一方法是完全擦除 C:\Users\ 区域下的个人资料,并强制系统在该人重新登录后重新创建登录。这似乎可以解决 API 问题,并且它再次工作,但是该用户通常不再可见这些任务,因为开发的任务是特定于用户而不是 Windows 7 中的计算机。另一个奇怪的事情是,有时,尽管没有任何可以分析的频率,即使 API 已损坏且无法打开,任务仍会运行。这个问题的原因显然尚不清楚,但各个网站上描述了许多“修复”,但用户配置文件删除和重新添加似乎每次都有效至少一段时间。这些任务现在在 WIN 7 中保存为 XML,因此,如果您在 system32/tasks 文件夹中找到它们,您可以删除它们,或将它们复制到新驱动器,然后将它们导入回任务计划程序。不过,我们还是使用了 Splinterware 的系统调度程序软件,因为我们多次遇到相同的损坏问题,即使修复似乎不是永久性的。
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.
在较新版本的 Windows(Windows 10 和 Windows Server 2016)上,您创建的任务位于
C:\Windows\Tasks
中。它们将具有扩展名.job
例如,如果您创建任务“DoWork”,它将在以下位置创建任务
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
For example if you create the task "DoWork" it will create the task in