{"id":110098,"date":"2024-08-05T07:00:00","date_gmt":"2024-08-05T14:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=110098"},"modified":"2024-08-05T06:56:27","modified_gmt":"2024-08-05T13:56:27","slug":"20240805-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20240805-00\/?p=110098","title":{"rendered":"What are the dire consequences of registering a RunOnce command from my RunOnce command?"},"content":{"rendered":"<p>The <a title=\"Run and RunOnce Registry Keys\" href=\"https:\/\/learn.microsoft.com\/windows\/win32\/setupapi\/run-and-runonce-registry-keys\"> documentation on the <code>Run<\/code> and <code>RunOnce<\/code> keys<\/a> contains this caution:<\/p>\n<blockquote class=\"q\"><p>An application must not continually recreate entries under <code>RunOnce<\/code> because this will interfere with Windows Setup.<\/p><\/blockquote>\n<p>What is this &#8220;interfere with Windows Setup&#8221; all about?<\/p>\n<p>There&#8217;s a clue earlier in that same paragraph:<\/p>\n<blockquote class=\"q\"><p>Applications should use the <code>RunOnce<\/code> key only for transient conditions, such as to complete application setup.<\/p><\/blockquote>\n<p>The intended purpose of the <code>RunOnce<\/code> is to allow application installers to do some work after a restart to complete the installation. Therefore, any pending <code>RunOnce<\/code> entries suggest that an application install is still in progress, and Windows Setup tries not to upgrade a system while an application is in the middle of installing. (After all, who writes an installer that handles the case where the operating system is upgraded mid-install?)<\/p>\n<p>Windows Setup is used not just for installing Windows from scratch, but also for upgrading from one version of Windows to another. And any persistent <code>RunOnce<\/code> entry will cause Windows Setup to keep asking, &#8220;My goodness, can this application finish installing so I can finally start upgrading the OS?&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The circle of life, or a perpetual motion machine.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-110098","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>The circle of life, or a perpetual motion machine.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/110098","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=110098"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/110098\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=110098"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=110098"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=110098"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}