I need to create an environment variable for another local user in windows. For example, say suppose there are 2 users in the system (User1 and User2). Currently User1 is logged in the system. Now Is there any way we can create user level environment variable for User2 using C# .Net 2.0.
If we use Environment.SetEnvironmentVariable(envName, envValue, EnvironmentVariableTarget.User) then it will create the environment variable for the currently logged in user i.e. User1.
Even if we try setting the registry key HKEY_CURRENT_USER\Environment still it will create the variable for currently logged in user.