I stumbled upon what I think is a neat way to enumerate the directories that are currently in your path. Have you ever wanted to look at your current path in Windows and typed "SET PATH" only to see a mongo list of concatenated paths containing spaces in their names nailed together with semicolons that hypnotize you if you stare at it too long? Well, sure you could pipe the output of SET PATH to your favorite text parser (sed, awk, perl, csript anyone?) if you felt particularly masochistic, but here's another way using a default built-in command: "WHERE ."

So if your path looked something like this:

C:\>set path
Path=C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin;C:\Program Files\Microsoft Visual Studio.NET 2003\Common7\IDE\;C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin;C:\WINDOWS\system32;C:\WINDOWS;c:\depot;c:\dev\bin;
C:\dev\bin\cygwin\bin;c:\dev\bin\jdk1.4.1_01\bin;C:\Program Files\emacs-21.2\bin;C:\Program Files\Microsoft SQL Server\90\Tools\Binn\;C:\dev\bin\sfu30\common\;C:\PROGRA~1\CA\SHARED~1\SCANEN~1;C:\PROGRA~1\CA\ETRUST~1;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn;C:\CTS;c:\Program Files\WinZip

try this:

C:\>where .
.\.
C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin\.
C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\.
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\.
C:\WINDOWS\system32\.
C:\WINDOWS\.
c:\depot\.
c:\dev\bin\.
C:\dev\bin\cygwin\bin\.
c:\dev\bin\jdk1.4.1_01\bin\.
C:\Program Files\emacs-21.2\bin\.
C:\Program Files\Microsoft SQL Server\90\Tools\Binn\.
C:\dev\bin\sfu30\common\.
C:\PROGRA~1\CA\SHARED~1\SCANEN~1\.
C:\PROGRA~1\CA\ETRUST~1\.
C:\Program Files\Microsoft SQL Server\90\DTS\Binn\.
C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\.
C:\CTS\.
c:\Program Files\WinZip\.

WHERE.EXE ships with Windows XP Server 2003 and up [Thanks to Ilya for the correction. --Ed] as well as the Windows Resource kits since Win2K (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tools/tools/where.asp) and simply tells you where in the user path the input executable is found. Since "." is the current directory, it is found in every directory in the path, and hence the above output. How dat?