Works on this device
Environment Path Deduplicator
Paste the text of your PATH variable. The tool splits it into entries, removes the ones that name the same folder again, and gives you the cleaned value. It works on text only and cannot change your system.
Your PATH value
Check these values
Your values are worked out in this browser. They are not sent to a server.
Your result will show here
Paste the value of PATH, or choose Try an example.
Result
How it was worked out
How to use this tool
- Get the value of PATH from your system. In the Windows command prompt type
echo %PATH%. In PowerShell type$env:Path. In a Linux or macOS shell typeecho "$PATH". - Paste the value into the box. A value with one entry on each line also works.
- Read the table. It shows each entry, if it was kept or removed, and remarks such as quotes or an empty entry.
- Copy the cleaned value. If you want a command that sets it, choose your shell.
- Keep a copy of your old value before you change PATH.
The rules used
- Style: a value with a semicolon or a backslash, or with a drive letter, a colon and a slash at its start, is read as Windows style. Any other value is read as POSIX style. You can also choose the style yourself.
- Splitting: a Windows value is split at each semicolon that is not inside double quotes. A POSIX value is split at each colon. A line break also separates entries.
- Same entry in Windows: double quotes are left out, capital and small letters are the same,
/is read as\, and a slash at the end does not matter. SoC:\Tools\bin\andc:/tools/binare the same entry. - Same entry in POSIX: the text must be exactly the same, because capital and small letters are different in file names there. You can choose a looser rule that ignores letter case and a slash at the end.
- Which one is kept: the first one. The system searches the folders of PATH in order, so keeping the first one does not change which program is found.
- Empty entries: in Windows an empty entry does nothing. In a POSIX PATH an empty entry means the current folder, which is a known risk, so it is removed unless you untick that option.
Worked example
The value C:\Windows\system32;C:\Windows;C:\Program Files\Git\cmd;c:\windows\;;C:\Tools\bin\;C:/Tools/bin;"C:\Program Files\Git\cmd" has 8 entries. Entry 4 is the same as entry 2, entry 5 is empty, entry 7 is the same as entry 6, and entry 8 is the same as entry 3. The cleaned value is C:\Windows\system32;C:\Windows;C:\Program Files\Git\cmd;C:\Tools\bin\ with 4 entries.
Limits you should know
- The page cannot read or change the variables of your system. The command it writes is text; you run it yourself, and it changes PATH only for the window or session where you run it.
- Names such as
%SystemRoot%or$HOMEare compared as text and are not replaced by their values. Two entries that reach the same folder in different ways, also through links or short names, are not found. - The tool does not check that a folder exists.
- Windows keeps two PATH values, one for the system and one for your user, and joins them. Clean each of them on its own; an entry that is in both is not a mistake you can fix in only one of them.
- The Windows program
setxcuts a value at 1,024 characters, so it is not a safe way to save a long PATH. Use the Environment Variables window of Windows. - The value can have up to 100,000 characters.