views:

955

answers:

1

I have a setup project in which I have a custom action that is adding the target folder to the path. Nothing special, works ok, adds it to the path.

However if I then open a cmd window it's not available. If I psexec and try to directly run something that is in the folder it isn't found.

I logged off the box and on again and it turned up in the cmd echo %PATH% command however this isn't really an option in production.

I will probably be installing the msi via psexec and then I want to then make a second call using something in that folder.

so

psexec \machine-name msiexec /I setup.msi /qn psexec \machine-name exeinabovemsi

Is there something I need to do to flush the path out, it is in the "My Computer -> Properties -> Advanced -> Environment Variables -> Path" list as soon as the msi has installed, just doesn't turn up in the new cmd windows etc.

Thanks

Alan

+1  A: 

From http://support.microsoft.com/kb/104011:

However, note that modifications to the environment variables do not result in immediate change. For example, if you start another Command Prompt after making the changes, the environment variables will reflect the previous (not the current) values. The changes do not take effect until you log off and then log back on.

To effect these changes without having to log off, broadcast a WM_SETTINGCHANGE message to all windows in the system, so that any interested applications (such as Windows Explorer, Program Manager, Task Manager, Control Panel, and so forth) can perform an update.

arolson101