Share via

documented feature by Microsoft

Hector Donolo 5 Reputation points
2026-02-10T19:16:23.4466667+00:00

for RunOnce, is the ! prefix a documented feature by Microsoft

Developer technologies | C++
Developer technologies | C++

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.

{count} votes

3 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Gade Harika (INFOSYS LIMITED) 2,590 Reputation points Microsoft External Staff
    2026-02-11T08:52:11.7466667+00:00

    Thanks for reaching out.
    Yes. The ! prefix for RunOnce registry values is a documented Microsoft feature.

    According to Microsoft documentation, when a RunOnce registry entry name starts with !, Windows does not delete the value before execution. This ensures the entry is removed only after the command runs successfully. If the command fails, the entry remains and will be retried on the next logon or startup.

    This behavior is documented for the following registry paths:

    • HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
    • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce

    Summary of behavior:

    • RunOnce without ! → entry is removed before execution
    • !RunOnce → entry is removed after successful execution

    This is intended for scenarios where reliability is important and the operation must retry if it fails.

    References:

    • Microsoft Run and RunOnce Registry Keys documentation
    • Microsoft Q&A and Windows Driver documentation on RunOnce behavior.

    Let us know if the issue persists after following these steps. I’ll be happy to assist further if needed. If the issue has been resolved, Kindly mark the provided solution as "Accept Answer", so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.


  3. Q&A Assist
    2026-02-10T19:16:30.2966667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    Yes, the ! prefix is a documented feature by Microsoft for the RunOnce registry keys. It is used to defer the deletion of the RunOnce key until after the command runs successfully. If the RunOnce operation fails and the key does not have the ! prefix, the associated program will not be executed the next time the system starts. This behavior is outlined in the documentation regarding the RunOnce registry key.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.