• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Command added to Windows 7 system path sometimes works

Spungo

Diamond Member
I can't get the 7zip command line to work properly. Sometimes it works, sometimes it doesn't. I just don't understand how Windows uses the system path.

I'm talking about this kind of system path (this is not my image, it's just an example):

environment-variables-path-cygwin.png


I've added 7zip's folder to the system path so I can use "7z" as a command.
If I hit windows+R and run the command "cmd" to open a command prompt, the prompt it opens can use the 7z command. Great!
If I shift right click in a folder and select "open command window here", the prompt it opens cannot use the 7z command.

What's going on? Why does it work when I use the cmd command to open a prompt but it doesn't work when I "open command window here" to open a prompt?
 
There are two PATH variables, one is local to your user account and the other is set at the system level. You are probably running as an Administrator with UAC disabled and are entering an elevated command prompt without realizing it half of the time.
 
Last edited:
First, you should add it to the system variables (the lower box, not the upper box) as suggested so that it's good for all users (that having been said, if your user has admin privs, then UAC will simply elevate your account instead of running in a separate admin account, in which case, that won't be the problem).

Also, environment variables are inherited from the process that launches it. So even after you change the environment variables, if Explorer launches a process, that process will still have the variables that particular Explorer process had. There are usually two Explorer processes--one that handles the task bar, start menu, and desktop, and one for everything else, so if the two Explorer processes have two different sets of environment variables, then processes launched from the two would also have two different sets of variables. Logging out and logging back in would fix this. (There's also a message that can be programmatically broadcast to get Explorer and other processes to refresh their environment variables.)
 
Back
Top