Search PATH for duplicates

Table of contents
  1. 1. Comments

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.

Enjoy!

Comments

me wrote:

one line “which” command (but you have to include the extension):

@echo.%~$PATH:1

found by way of http://blogs.msdn.com/oldnewthing/archive/2005/01/20/357225.aspx#357612

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

http://blogs.msdn.com/oldnewthing/archive/2005/01/20/357225.aspx#357327

    Send feedback