I am using the Environment.SetEnvironmentVariable method call in C # (.NET 3.5) as follows:
Environment.SetEnvironmentVariable (environmentVariable, cost, "Machine");
However, this single call takes more than 2 seconds on several test systems (works both XP and Windows 7). I found out that this could be because: "If the target is a User or a machine, other applications are notified of the specified operation with the Windows WM_SETTINGCHANGE message." Is there a way to suppress this notification for other applications so that my environment installs quickly and comes back ??
Please note that I have a component that sets about 20 environment variables, and if I use the function as I described above, it takes about a minute to complete this task.
Please suggest !!
source
share