Repository navigation
docs: Windows autostart task without the 72-hour limit - #7
Merged
Merged
Conversation
A task made with `schtasks /create` gets ExecutionTimeLimit PT72H, so Windows stopped the agent three days after boot, and it did not start on battery power. schtasks has no switch for either, so the docs now use Register-ScheduledTask with -ExecutionTimeLimit 0 (PT0S), the battery switches and restart on failure: the task the setup app creates. Checked on Windows 11: a schtasks task reads back PT72H, the new settings read back PT0S, and -Force replaces an old task. Source: https://learn.microsoft.com/en-us/windows/win32/taskschd/tasksettings-executiontimelimit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TEvvb1DM3ZA5FqELYSs4v8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
docs/agent.mdanddocs/migration.mdcreated the autostart task withschtasks /create. Such a task getsExecutionTimeLimitPT72H(Microsoft: "By default, a task will be stopped 72 hours after it starts to run"), so Windows stopped the agent three days after boot. It also did not start on battery power.schtaskshas no switch for either.The docs now use
Register-ScheduledTaskwith-ExecutionTimeLimit 0, the two battery switches and restart on failure, the same settings as the task XML the setup app writes (crates/agent/src/install.rs,task_xml). There is a note for tasks made the old way (-Forcereplaces them).Checked on Windows 11 with throwaway tasks under a normal user: a
schtasks /createtask reads backPT72Hand battery start off; the new settings read backPT0S, restart 255 ×PT1M, batteries allowed;-Forceturns an old task into the new one. Not run here: theSYSTEMaccount itself, which needs an elevated shell. A task XML file was not an option:schtasks /xmlrejects a UTF-8 file with anencoding="UTF-8"declaration.🤖 Generated with Claude Code
https://claude.ai/code/session_01TEvvb1DM3ZA5FqELYSs4v8