DOS equivalent of unix 'whence' or 'type'

Found this construct looking in the help for FOR – I can’t quite work out how to use it in a batch file, sadly…..

for %I in (“sqlplus.exe”) do echo %~$PATH:I

gives

D:oracleproduct10.2.0client_1BINsqlplus.exe

Update:

With many thanks to my friend Dave….

To create a whence.bat script, you need to have the following content:

@echo off
set TO_FIND=%1
for %%I in (“%TO_FIND%”) do echo %%~$PATH:I

…then you can type, for example, ‘whence sqlplus.exe’ to locate sqlplus.

Advertisements