I needed to add a new entry to my PATH variable. This is a common activity for me in my job, but I've recently started using Windows 8. I assumed the process would be similar to Windows 7, Vista, XP...
Here's my sequence of events:
- Open System properties (Start-> [type "Control Panel"] -> Control Panel\System and Security\System -> Advanced system settings -> Environment Variables)
- Add the new path to beginning of my USER PATH variable (C:\dev\Java\apache-ant-1.8.4\bin;)
- Opened a command prompt (Start -> [type "command prompt" enter] -> [type "path" enter]
My new path entry is not available (see attached image and vide). I Duplicated the exact same process on a Windows 7 machine and it worked.
EDIT
Windows 8 Environment Variables and Command Prompt video
EDIT
This is definitely not the behavior of Windows 7. Watch this video to see the behavior I expect working in Windows 7. http://youtu.be/95JXY5X0fII
EDIT 5/31/2013
So, after much frustration, I wrote a small C# app to test the WM_SETTINGCHANGE
event. This code receives the event in both Windows 7 and Windows 8. However, in Windows 8 on my system, I do not get the correct path; but, I do in Windows 7. This could not be reproduced in other Windows 8 systems.
Here is the C# code.
using System;
using Microsoft.Win32;
public sealed class App
{
static void Main()
{
SystemEvents.UserPreferenceChanging += new UserPreferenceChangingEventHandler(OnUserPreferenceChanging);
Console.WriteLine("Waiting for system events.");
Console.WriteLine("Press <Enter> to exit.");
Console.ReadLine();
}
static void OnUserPreferenceChanging(object sender, UserPreferenceChangingEventArgs e)
{
Console.WriteLine("The user preference is changing. Category={0}", e.Category);
Console.WriteLine("path={0}", System.Environment.GetEnvironmentVariable("PATH"));
}
}
OnUserPreferenceChanging
is equivalent to WM_SETTINGCHANGE
C# program running in Windows 7 (you can see the event come through and it picks up the correct path).
C# program running in Windows 8 (you can see the event come through, but the wrong path).
There is something about my environment that is precipitating this problem. However, is this a Windows 8 bug?
EDIT 2014-04-28
Due to this and several other issues, we no longer use Windows 8 on the desktop. We do not have an environment to continue testing and experimenting with this problem. There is still no answer or resolution to this problem for us. The answers below did not resolve our problem.
cmd
when a new instance was launched. Of course the already runningcmd
didn't get the updated environment.