Search PATH for duplicates
A recent thread on the osgeo4w mailing list prompted me to scratch an itch
I’ve encountered a few times: trying to figure out if there is more than one
executable DLL or EXE in the search path with the same name. The result is
dupe-search.bat. Invocation is a simple dupe-search [dir to look for dupes
of]
, example:
dupe-search c:\osgeo4w\bin
Results are saved in %temp%\dupes.txt
It’s not all that intelligent, there is no effort to avoid text files for
example, but it works well enough for what it does (for me anyway). The most
significant thing I learned, had me scratching my head for a couple of hours,
was that a semi-colon at the beginning of PATH (path=;c:\something;c:\other
)
or double semicolons (path=c:\other;;c:\else
) gives unexpected results, and
that one can edit path in-situ.
Notes
One line which
command (but you have to include the file's extension):
@echo.%\~\$PATH:1
A longer version which ignores the extension is
@for %%e in (%PATHEXT%) do @for %%i in (%\~n1%%e) do @if NOT
“%%\~\$PATH:i”==”" echo %%\~\$PATH:i