1

I ran into problems hitting the maximum length of the Windows PATH variable. I read an article that suggested extending it by creating another environment variable, say PATH1, adding additional directory paths to that new variable, then adding %PATH1% to the PATH variable. This works fine: I can see the directories in PATH1 listed when I do echo %PATH% and applications relying on directories listed in PATH1 seem to work okay.

However, after a few hours Windows File Explorer seems to forget the directories added to the PATH1 variable. I know it works right after a restart because PATH1 includes a directory with shortcuts which I run frequently via the Run dialog. Those shortcuts work for a few hours after a restart. But eventually I'll try to run a shortcut from the Run dialog and get the message Windows cannot find '<shortcut name>'. After that none of the shortcuts will work again until I restart the machine.

When I get that Windows cannot find '<shortcut name>' error message I can open a command prompt and run echo %PATH%. It will still include the directories added to the PATH1 variable. So it's not like Windows as a whole has forgotten the directories in PATH1. It seems to be just File Explorer.

Is there some memory pressure or something that might cause this after a few hours? Is there anything I can do to avoid it?

7
  • 1
    What happens if you just Restart Explorer?
    – harrymc
    Aug 18, 2022 at 9:32
  • Good question, I hadn't thought of that. I'll try it next time.
    – Simon Elms
    Aug 18, 2022 at 10:15
  • 1
    You are trying to fight the wrong fight. Trim down your path. Just because every stupid company tries to put their crap in your path doesn't mean you NEED those things in your path. Most of the tools that do this are Linux based. On Linux, everything ends up in a pre-determined path that already exists (like /bin or /usr/bin). On windows, they say F**k it! and add their product to the path. If you are working on something like go or python, create a batch file to launch your environment and put the garbage there. Aug 18, 2022 at 15:16
  • @SeñorCMasMas: The worst offender I've come across is SQL Server or, at least, its client tools, such as SQL Server Management Studio (SSMS) and SQL Server Integration Services. I've found I need several versions of SSMS installed to allow me to edit SQL Server Reporting Services reports for different versions of SQL Server. They just fill up the path.
    – Simon Elms
    Aug 18, 2022 at 21:38
  • 1
    Fair enough @SimonTewsi ! SQL Server is a bad actor in this case.. but usually when I see all of their crap in the path, it isn't on a machine with a go, python, java, whatever developer (where the paths get simply stupid). Good point though. I delete the SQL Server stuff from my path every time and oddly, it still works with no issues. Aug 19, 2022 at 14:57

1 Answer 1

1

The reason for this happening are unknown, perhaps some installed add-on to Explorer or an interference by some installed program. This perhaps can be checked by booting in Safe mode (if the problem can happen in this mode).

A workaround that returns Explorer to its initial state is to Restart Explorer. The simplest method is to run Task Manager, Processes tab, find Windows Explorer, right-click it and select Restart. More methods can be found in the link.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .