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.

  • Different from this question because that user is just interested in finding out another way to edit the PATH variable. I am wondering if my system is in a damaged state and how I can recover. superuser.com/questions/387619/…
    – Doug
    Sep 17, 2014 at 0:16
  • 1
    you system won't be unstable, but find out from another windows 8 user or a webpage, what the path should be in a fresh windows 8 installation, and use that. And grow it if necessary. Always back up your PATH before using setx. Maybe there's a system restore you can do in windows 8 that can roll the path back? it's worth a try EDIT ADDED- next time when using setx, first do echo %PATH%>afile <-- and try setx on some other variable not PATH. Then when you're sure you have the setx line right, after trying it on TESTPATH,then do setx on PATH.
    – barlop
    Sep 17, 2014 at 0:20
  • 1
    If you haven't restarted a second time yet, you can look arty ghee CurrentControlSet backups.
    – Bob
    Sep 17, 2014 at 0:30
  • 3
    @Bob well if one hasn't restarted, and still has the same cmd window open, then after a setx, the path variable still isn't set in the current cmd window, and you can just echo %path% Anyhow, maybe system restore restores the path?
    – barlop
    Sep 17, 2014 at 1:39
  • 1
    about stability: basically, to get Windows itself working well, you just need `%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0`. Everything else is 3rd party software. nVidia will re-add its entries on driver update, and it works well even without. Path-related problems are rare and usually apparent, so you can just deal with them case-by-case. About expanding path: use pathman.exe from resource kit. But bear in mind limits superuser.com/a/387625 Oct 7, 2016 at 15:19

2 Answers 2


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.

  • 2
    There will typically be several "ControlSetXXX" registry keys, of which the CurrentControlSet key mentioned is one. No need for any restore points to just have a look at them.
    – kreemoweet
    Feb 13, 2017 at 16:52

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
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
Value: 1 = enabled
    0 = disabled

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.