14

I received an error on Windows 8 after trying to use SETX to add JAVA.exe to the Windows PATH variable:

WARNING: The data being saved is truncated to 1024 characters.

After a reboot, I notice that the PATH is indeed much shorter than before. I've since read that SETX can't handle more than 1024 characters. That would have been good to know in the article which recommended using it.

I am wondering if my system will be unstable now that (presumably) some of the directories no longer appear in the PATH variable. The end of the string is clearly cut off mid-directory (at Pr):

(...) ;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Pr

Is there any way to roll back or anywhere that the previous value of PATH was captured. Man, I can't believe this kind of stuff can still happen in Windows after 29 years.

Doug
  • 325

2 Answers2

5

PATH is saved in the Registry at

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

If you have system restore points, you can find the relevant key and restore it.

Sir Adelaide
  • 4,977
  • 2
  • 16
  • 36
1

Don't have enough reputation to comment here, but @kreemoweet's comment - unfortunately, Windows 10 (and I believe 8/8.1 as well) disabled the "last known good config" option and the associated backups that it used to be able to restore (the ControlSet### that you speak of). This behavior can be re-enabled via a reg fix, but unless the user manually did this, its very likely that they will only find one control set (which will in fact be the CurrentControlSet) when looking in the registry). So a system restore might be in order here.

In case anyone else comes across this, the way to re-enable the ControlSet### backups in the registry is to add a reg value:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager

Name: BackupCount
Type: DWORD
Value: 1 = store one backup in registry (one "last known good config")
    2 = store two backups in registry (two "last known good configs")

The above enables the ControlSet### backups. Then, if you also want to enable the "last known good config" option on the (legacy) boot menu (which would also need to be re-enabled in Win8/8.1 I believe, for this option to actually show up), you need to add:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager\LastKnownGood

Name: Enabled
Type: DWORD
Value: 1 = enabled
    0 = disabled
dwillis77
  • 111