REG FLAGS /?


Reg.exe in Vista has gain a new command line option “flags”.  You can use it to see some interesting things, for example, whether a registry key is virtualized.


C:\>reg flags /?


REG FLAGS KeyName [QUERY |
                   SET [DONT_VIRTUALIZE] [DONT_SILENT_FAIL] [RECURSE_FLAG]]


  Keyname    “HKLM\Software”[\SubKey] (Restricted to these keys on
        local machine only).
    SubKey   The full name of a registry key under HKLM\Software.
  DONT_VIRTUALIZE DONT_SILENT_FAIL RECURSE_FLAG
    Used with SET; flags specified on the command line will be set,
        while those not specified will be cleared.


Examples:


  REG FLAGS HKLM\Software\MyCo\MyApp QUERY
    Displays the current flags of the key MyApp.


  REG FLAGS HKLM\Software\MyCo\MyApp SET DONT_VIRTUALIZE /s
    Sets the DONT_VIRTUALIZE flag (and clears DONT_SILENT_FAIL and
    RECURSE_FLAG) on MyApp and all its subkeys



C:\>reg flags “HKLM\SOFTWARE\Microsoft\Windows NT” query


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT
        REG_KEY_DONT_VIRTUALIZE: SET
        REG_KEY_DONT_SILENT_FAIL: CLEAR
        REG_KEY_RECURSE_FLAG: SET


The operation completed successfully.

Comments (2)

  1. Norman Diamond says:

    > flags specified on the command line will

    > be set, while those not specified will be

    > cleared.

    What an awful user interface.  Even though the behaviour is documented, it is so far from intuitive that it deserves blame for all the problems it’s going to cause.

    A proper user interface would provide that flags not specified would not be changed, not set, not cleared, except when the user specifies some other flag that conflicts with it.

    In accordance with some naming conventions (such as a famous predecessor of Windows NT) the way to clear the DONT_VIRTUALIZE flag would be to say NODONT_VIRTUALIZE, not to simply omit the flag.  For readers of English a more readable way would be to have a DO_VIRTUALIZE flag.  For people with computer experience but not much English skill, a better way might be NOVIRTUALIZE and VIRTUALIZE.  Or +VIRTUALIZE and -VIRTUALIZE.

  2. Tom says:

    Yep, Norman has a point…