Windows 在哪里存储计划任务控制台的设置?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20454115/
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 11:09:27  来源:igfitidea点击:

Where does Windows store the settings for Scheduled Tasks console?

windowsscheduled-tasks

提问by Evan

I would like to know where Windows stores information for Scheduled Tasks. I would like to be able to find the reference for the name, schedule, or command to run associated with a given task. This may not be practical or possible, but I would also like a means to edit the scheduled tasks and their attributes outside the Schedule Tasks console. I've assumed that the data would be in the Registry somewhere, since I doubt it would be stored in a normal file, but I'm uncertain where I should be looking.

我想知道 Windows 在哪里存储计划任务的信息。我希望能够找到与给定任务相关联的要运行的名称、计划或命令的参考。这可能不切实际或不可能,但我还想要一种在计划任务控制台之外编辑计划任务及其属性的方法。我假设数据会在注册表中的某个地方,因为我怀疑它会存储在普通文件中,但我不确定应该在哪里查找。

回答by malexander

Windows stores scheduled tasks as XML files, AND in the registry.

Windows 将计划任务存储为 XML 文件,并存储在注册表中。

You can find them in a few places:

您可以在以下几个地方找到它们:

Filesystem:

文件系统:

%systemroot%\System32\Tasks
%systemroot%\Tasks

%systemroot%\System32\Tasks
%systemroot%\Tasks

Registry:

注册表:

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

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

Note: You can't edit the XML files directly in \Tasks for security reasons. See here for more information: https://serverfault.com/questions/440496/ok-to-edit-tasks-xml-file-in-c-windows-system32-tasks

注意:出于安全原因,您不能直接在 \Tasks 中编辑 XML 文件。有关更多信息,请参见此处:https: //serverfault.com/questions/440496/ok-to-edit-tasks-xml-file-in-c-windows-system32-tasks

To work with importing the XML files without going through the scheduled task UI you can look at these:

要在不通过计划任务 UI 的情况下导入 XML 文件,您可以查看以下内容:

Schtasks.exe
Powershell Scheduled Task Cmdlets

Schtasks.exe
Powershell 计划任务 Cmdlet

回答by user3077538

In Windows 7 they are stored in files under "Windows\System32\Tasks". The files are XML, so you could create and edit task files there.

在 Windows 7 中,它们存储在“Windows\System32\Tasks”下的文件中。这些文件是 XML,因此您可以在那里创建和编辑任务文件。

Other versions of Windows I think they are stored in "%SystemRoot%\Tasks"

其他版本的 Windows 我认为它们存储在“%SystemRoot%\Tasks”中

回答by Steve

I needed to delete some tasks as in a script as the final part of a system build.

作为系统构建的最后一部分,我需要删除脚本中的一些任务。

I discovered you can just delete them eg:

我发现你可以删除它们,例如:

@echo ..Audit hardware

"\vs-files\General##代码##00 IT\Bginfo.exe" "\czwgbak\Software\_Build2015\AuditWorkstation.bgi" /timer:0 /Silent /NOLICPROMPT

@echo delete Scan Setup inis

If not exist %systemroot%\System32\Tasks\ASUS\nul goto reg
rd %systemroot%\System32\Tasks\ASUS /S /Q

:reg

etc...

等等...