How can I set a Windows user environment variable that takes effect for the current session?

Posted by Graham Powell on Server Fault See other posts from Server Fault or by Graham Powell
Published on 2010-04-26T21:20:42Z Indexed on 2010/04/26 21:23 UTC
Read the original article Hit count: 417

I am trying to set a Windows user environment variable and then launch an application via either batch file or a script. However, the environment variable is not set to the appropriate value until after the user logs off and logs back on. (I think a more accurate description would be that the new value is not available to the app until after the next logon.)

Is there any way to set a variable in the user's environment so that it's immediately available?

I'm doing this because this program's functionality can be controlled by environment variables, and users will need different functionality at different times. Because of license constraints I need to set this dynamically, if possible.

Thanks,

Graham

© Server Fault or respective owner

Related posts about Windows

Related posts about environment-variables