How can I determine whether a particular folder in the PATH environment variable is used by the system?

Recently, some software that relied on the system PATH stopped working b/c another package added too many characters to the beginning the variable, causing important parts to be truncated at the end.

This led me to cleaning up the variable by removing some unused directories and shortening others; however, I still have quite a bit left over that I'm unsure of and I'm wondering if there is a way to determine whether certain parts of the PATH variable are used/unused by any process on the system.

Ideally I would love a list of dependencies, however, I would be happy with a method that can log failed/successful attempts. Any ideas?


My goal is to determine if it's safe to remove a directory from PATH without breaking anything, therefore I need to know if a file was accessed specifically by looking it up in the PATH.

  • I think NTFS supports atime (not 100%sure). I time is time of last read (access time). You can use atime to determine which files are being used. It will not be fool proof though. Jul 24, 2014 at 13:19
  • Good question. I don't think there is a reliable way of doing it. I usually manually look through the %PATH% with my "Add/Remove Programs" open and just remove paths to programs that have been removed. I am also interested in seing more rational solutions posted here Jul 24, 2014 at 13:21
  • @richard: thanks, but while this could help me determine if any items in the directory are accessed, I don't see how it can tell me whether they were accessed via the PATH. I'll edit my question to clarify this. Jul 24, 2014 at 13:24
  • @JensEhrich, yes that is correct, that is what I meant by not fool proof (I was not so clear, sorry). I think your question is clear though. Jul 24, 2014 at 14:21
  • Look at a freshly installed OS, note that path setting and use it in the existing system. Then as you run into things that are now broken, add their entries back to the path. That's about the only way I can think of. Jul 24, 2014 at 15:14

1 Answer 1


There is no reliable way to ensure this. For example an application can insert the custom path while it is installed, and not log it anywhere else, even in it's own settings/files. In this case there is no way to search anywhere else to ensure it is needed or not, and if you remove the path entry it is going to break.

That is about making sure 100% , in practical cases you can remove any entries related to uninstalled programs and directories which no longer exists with a good level of confidence.

You must log in to answer this question.

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