Fixing 'Path' in Environment Variables in Windows 7 for Multiple Applications

Fixing 'PATH' in Environment Variables in Windows 7 for multiple applications

Separate the paths to Ruby and Java with your system's path separator character.

In case of Windows 7, it's

;

You'll be able to use both

Here's an example of Path variable with numerous applications.

C:\Program Files\TortoiseHg\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\

Windows 7 environment variable not working in path

I had exactly the same problem, to solve it, you can do one of two things:

  • Put all variables in System Variables instead of User and add the ones you want to PATH

Or

  • Put all variables in User Variables, and create or edit the PATH variables in User Variable, not In System. The Path variables in System don't expand the User Variables.

If the above are all correct, but the problem is still present, you need to check the system Registry, in HKEY_CURRENT_USER\Environment, to make sure the "PATH" key type is REG_EXPAND_SZ (not REG_SZ).

Multiple Applications in PATH variable

You cant have spaces between each path like:

C:\Program Files\MySQL\MySQL Server 5.7\bin; C:\Ruby23-x64\bin; C:\Program Files (x86)\Microsoft VS Code\bin

remove spaces

C:\Program Files\MySQL\MySQL Server 5.7\bin;C:\Ruby23-x64\bin;C:\Program Files (x86)\Microsoft VS Code\bin

Windows 7 install program, refresh path environment variable

If restart is not an option, you can try to kill every instance of explorer.exe, but i think this will also be not acceptable.

The correct way of doing it is sending a message to all top most windows to notificate of changes in the environment. But i don't know anything in the OS to do that. If you can include an exe and have access to a c compiler, this should do the trick

#include "windows.h"

void main(void) {
SendMessageTimeout(
HWND_BROADCAST,
WM_SETTINGCHANGE,
(WPARAM) NULL,
(LPARAM) "Environment",
SMTO_NORMAL,
1000,
NULL
);
}

I've tried compiling it with mingw/gcc in Windows 7 64 and seems to work without problems.

Why are Path Windows's environment variable and the command line different?

The value of the PATH environment variable you see on the command line (which has nothing to do with "DOS" btw) is the sum of the system wide PATH variable and the user specific PATH variable.

If you open the dialog with the system variables from within the control panel, the upper part contains the user specific environment variables. The lower part contains the system variables.

If you set a PATH variable for your user to e.g. c:\foo, and the system path is be c:\Windows\System32 then you'd see c:\Windows\System32;c:\foo when you do an ECHO %PATH% on the commandline.

How to recover deleted environment variables?

  1. In Windows 10 navigate to Start > Settings > Update & Security > Recovery
  2. Under Advanced Startup, click Restart Now
  3. Once the computer reboots into Advanced Startup, click Troubleshoot
  4. Click Refresh Your PC

Windows 10 restores, keeps all files and apps but removes drivers and custom settings.



Related Topics



Leave a reply



Submit