Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

After installing my new product version, when user does log-off and login into admin account or switch from admin account to non-admin account, PATH environment variable shows incorrect path of my product (previous product version’s path) using command prompt.

The PATH environment variable uses other environment variable (ABC).Environment variable "ABC" has relative path of my product(For ex:C:\\Program Files\myProduct_1.0).PATH Environment variable(like %ABC%\bin) is not refresh immediately after logoff and login admin account (or) switching from Admin account to Non-admin account.

This issue will not appear if user opens some applications like Internet Explorer, Notepad, WordPad, Excel, etc., before launching my product. Root cause of this issue is Windows refresh the PATH Environment variable after launching some application.

It seems windows refresh issue during session changes (logoff and login / switch from Admin to Non-admin account).

Why PATH environment variable is not refresh immediately after logoff and login/Switch from admin to non-admin mode?.

Please someone help me for this issue.
Posted
Comments
CHill60 2-May-14 10:51am    
Check that you have put your product path on the System PATH environment variable (needs to be done with an Admin account). It sounds like you have a User PATH variable set up instead
mari448 5-May-14 2:20am    
Thanks for your reply,

I have put my product path on the System PATH environment variable.It is not working.
Above description I have said that only System PATH environment variable not User environment variable.

The System PATH environment variable uses other environment variable (ABC).System Environment variable "ABC" has relative path of my product(For ex:C:\\Program Files\myProduct_1.0).The System PATH Environment variable(like %ABC%\bin) is not refresh immediately after logoff and login admin account (or) switching from Admin account to Non-admin account.

Why System PATH environment variable is not refresh immediately after logoff and login/Switch from admin to non-admin mode?.

Please help me on this...

1 solution

It has been my experience that one should never refer to environment variables in the PATH environment variables because they don't get resolved; so I am surprised that it works for you at all.

My only guess is that when it does work it's because something did a PATH %PATH%;... which caused the embedded environment variables to be resolved.

If that is the case, then maybe you could do likewise in your autoexec.bat or something.
 
Share this answer
 
v2
Comments
mari448 5-May-14 7:10am    
Hi,

Thanks for your reply

Can you please try the following test case and Share results:

1) Add a ABC in System environment variables.
2) Now add that variable %ABC% in the PATH environment variable separated by semicolon
3) Next log off the current user (ADMIN) or Switch to non-admin account(USER account).
4) Now log in again. Open cmd prompt and type PATH command
5) In the paths shown by this commands, For me it shows wrong path.

Please share whether the path command for you returned the correct directory path or wrong one.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900