12
3
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. http://superuser.com/questions/387619/overcoming-the-1024-character-limit-with-setx
– Doug – 2014-09-17T00:16:58.8331you 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 – 2014-09-17T00:20:56.400
Good suggestions, thanks. Default path: http://superuser.com/questions/657769/what-is-the-default-path-setting-for-windows-8
– Doug – 2014-09-17T00:22:35.6601If you haven't restarted a second time yet, you can look arty ghee CurrentControlSet backups. – Bob – 2014-09-17T00:30:24.667
see what I added in my edit re using setx. Also, (if I recall), there is no need to reboot. Just open a new command prompt and you see the new path. And also, since setx sets things in the registry.. you can always use the reg query command to view what it did. e.g. set reglocation=HKLM....<ENTER>
reg query "%reglocation%"
– barlop – 2014-09-17T00:31:07.163@Bob backups? what kind of backup would disappear after a restart? after running setx, the registry is changed e.g.
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
orHKCU\Environment
or whatever You may be right re backup (Though he did restart) but what is the reg key/location for what you are calling the backup? – barlop – 2014-09-17T00:33:42.110@barlop The "Last Known Good Configuration", under
HKLM\System\ControlSet002\...
I'm not sure if that's overwritten on the first or second restart. Come to think of it, maybe the first, in which case it's already too late. – Bob – 2014-09-17T00:46:59.4273@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 – 2014-09-17T01:39:41.150
@barlop That's a good point! System Restore should work here. – Bob – 2014-09-17T02:09:03.073
Doug what are you waiting for re system restore, have you tried it yet? do erport back – barlop – 2014-09-17T02:34:21.110
@barlop My system does seem stable, so I'm not going to go through with a system restore even though I think it's a good idea. If I have problems, then I will do a restore and report back, but until then I'm not going to chance it. Sys Restores have burned me in the past. – Doug – 2014-09-17T04:07:28.603
Restores are far more stable since Vista, so... if you had trouble with XP, it's probably fine now. – Bob – 2014-09-17T05:42:13.097
Note that when using commands like "setx PATH "%PATH%;<yourvar>" /M" you are effectively expanding the system + user PATH which will double your path and soon cause truncation after 1024 chars as noted here http://stackoverflow.com/questions/19287379/how-do-i-add-to-the-windows-path-variable-using-setx-having-weird-problems#26947177
– mkoertgen – 2016-02-12T14:41:24.4201
about stability: basically, to get Windows itself working well, you just need
– LogicDaemon – 2016-10-07T15:19:50.277%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 http://superuser.com/a/387625