Windows registry variables and environment variables?

At first glance, this seems like a purely subjective / aesthetic problem, but I would be interested to hear opinions (especially any technical ones) about whether environment or registry variables are the preferred place to store configuration data in a Windows environment.

Currently, I can only think of the following differences:

  • The registry settings are constant in all sessions, although I believe that environment variables can also have this property.
  • Easier to set environment variables from the command line and use regedit
    • (Counter argument: regedit easier for applications without a command line?)
  • Environment variables are more common on different platforms (?).

I also know that environment variables can be polled, modified, and set from the registry.

+6
environment-variables registry
source share
2 answers

Use environment variables when you plan to configure other applications (or a technical user) and that this configuration may be different (i.e. you have 2 instances working simultaneously, with different settings). Usually it is not necessary to clutter up the user environment. In most cases, use the registry or configuration file stored in $ HOME \ AppData \ Roaming \ YourApp.

+4
source share

When using Windows services, environment variables can be sick: just changing the variable and then restarting the service will not help. Normally you need to reboot the system.
If the service is viewing the settings in the registry, it is much easier.

I saw this behavior in Windows XP, I'm not sure that later versions have solved this problem.

0
source share

All Articles