How to determine whether a folder in %PATH% is required in Windows 7

7

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?

EDIT

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.

Jens Ehrich

Posted 2014-07-24T13:15:40.977

Reputation: 805

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. – ctrl-alt-delor – 2014-07-24T13:19:41.573

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 – Art Gertner – 2014-07-24T13:21:47.297

@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. – Jens Ehrich – 2014-07-24T13:24:20.613

@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. – ctrl-alt-delor – 2014-07-24T14:21:46.990

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. – Ƭᴇcʜιᴇ007 – 2014-07-24T15:14:18.677

Answers

2

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.

dbza

Posted 2014-07-24T13:15:40.977

Reputation: 508