I added a custom install action to my installer to add one of my installation directories to the System PATH environment variable. After I run the installer, the PATH variable reflects the changes (when I access it through the Control Panel::System applet), but when I start a new command shell, the PATH variable does not reflect the changes. Is there something I'm failing to do, that causes this?
Use "setx" and restart cmd prompt It's for reading and writing env variables. The variables persist after the command window has been closed. It "Creates or modifies environment variables in the user or system environment, without requiring programming or scripting.
I think this depends on how you are starting the new Command shell. For example, when you change the PATH environment variable under System properties, the change isn't reflected until you open a new Command prompt. I think when you launch a new "cmd" process (from the Run dialog for example), you get a fresh copy of all environment variables, but if you launch the command prompt a different way then you do not.
For something done thru a script like that, you may need to restart before you notice the change.
How are you starting the command shell? With the TaskManager?
I suspect you might be starting it from Explorer - if I remember correctly, this could meen that you are inheriting the parent processes (Windows Explorer in this case) PATH variable. Since that was set before your installer ran, you see the old value.
Not sure if this helps...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With