home *** CD-ROM | disk | FTP | other *** search
- FINDPATH (v1.1) - Where is a file in the PATH or other environment variable
-
- I use this program to save typing, as it will "find" the file I am
- going to edit. I simple made an E.BAT, like the one at the bottom of
- this file, that lets me edit a file by name (not path). For example,
- to look at the standard C include file, "MALLOC.H", I simply type
- "E MALLOC", and it will edit "H:\LANG\MSC51\INCLUDE\MALLOC.H".
-
- This program is Copyright 1989, by David G. Thomas.
- I may be reached at the PowerSoft BBS (404) 928-9294
-
- You are free to use this program as you please, and distribute it
- to your friends. I only ask that you do not alter the program, and
- you include this file when you pass it on.
-
-
- USAGE:
- FINDPATH name - Look in PATH for name.bat name.com name.exe
- FINDPATH env_var name - Look in env_var for name
- FINDPATH env_var name .suf - Look in env_var for name.suf
-
- Options (must be first arg)
- -FULL - Return the fully qualified path
- -SUBST - Return the fully qualified path, chasing SUBST disk
-
- The results are placed in the RET environment variable
-
-
- E.BAT
- ------------------------
- @echo off
- set editor=b
-
- :* This batch file will edit a file, given only the file name.
- :* If necessary, it will search the INCLUDE and PATH environment
- :* paths for the file. Also, a special path named E_PATH is used.
-
- if exist %1 goto use_args
-
- findpath E_PATH %1 .c .h .bat .asm
- if NOT errorlevel 1 goto frompath
-
- findpath INCLUDE %1 .c .h .bat .asm
- if NOT errorlevel 1 goto frompath
-
- findpath PATH %1 .bat
- if NOT errorlevel 1 goto frompath
-
- :use_args
- %editor% %1 %2 %3 %4 %5 %6 %7
- goto end
-
- :frompath
- %editor% %RET%
-
- :end
-