How does windows know the default mail client registry

In Windows, the default mail client is determined by the registry key HKEY_CLASSES_ROOT\mailto\shell\open\command. This key specifies the command that should be executed when the user clicks on a mailto link or tries to open a mail client.

Here's a breakdown of the registry key:

The default value of the command key is usually set to the path of the default mail client's executable file, followed by any command-line arguments that are needed to launch the client. For example, if the default mail client is Microsoft Outlook, the value might be:

"C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.EXE" /mail

When the user clicks on a mailto link, Windows checks the registry key HKEY_CLASSES_ROOT\mailto\shell\open\command to determine the default mail client. If the key is present and has a valid value, Windows executes the command specified in the value.

It's worth noting that the registry key can be modified by the user or by other applications to change the default mail client. Additionally, some mail clients may use other registry keys or methods to determine their default status.