Settings in the Windows Console Host can be a bit tricky to understand. This is mostly because the settings system evolved over the course of decades. Before we dig into the details of how settings are persisted, it's probably worth taking a quick look at what these settings are.
Settings are persisted to a variety of locations depending on how they are modified and how the Windows Console Host was invoked:
* Hardcoded settings in conhostv2.dll
* User's configured defaults (stored as values in `HKCU\Console`)
* Per-console-application storage (stored as subkeys of `HKCU\Console`). Subkey names:
* Console application path (with `\` replaced with `_`)
* Console title
* Windows shortcut (.lnk) files
To modify the defaults, invoke the `Defaults` titlebar menu option on a Windows Console Host window. Any changes made in the resulting dialog will be persisted to the registry location mentioned above.
To modify settings specific to the current application, invoke the `Properties` titlebar menu option on a Windows Console Host window. If the application was launched directly (e.g. via the Windows run dialog), changes made in the dialog will be persisted in the per-application storage location mentioned above. If the application was launched via a Windows shortcut file, changes made in the settings dialog will be persisted directly into the .lnk file. For console applications with a shortcut, you can also right-click on the shortcut file and choose `Properties` to access the settings dialog.
When console applications are launched, the Windows Console Host determines which settings to use by overlaying settings from the above locations.
1. Initialize settings based on hardcoded defaults
2. Overlay settings specified by the user's configured defaults
3. Overlay application-specific settings from either the registry or the shortcut file, depending on how the application was launched
Note that the registry settings are "sparse" settings repositories, meaning that if a setting isn't present, then whatever value that is already in use remains unchanged. This allows users to have some settings shared amongst all console applications and other settings be specific. Shortcut files, however, store each setting regardless of whether it was a default setting or not.
## Known Issues
* Modifications to system-created Start Menu and Win-X menu console applications are not kept during upgrade.
## Adding settings
Adding a setting involves a bunch of steps - see [AddASetting.md](AddASetting.md).