home *** CD-ROM | disk | FTP | other *** search
/ Mega CD-ROM 1 / megacd_rom_1.zip / megacd_rom_1 / DESQVIEW / MIXEDBAG.ZIP / FINDPATH.DOC < prev    next >
Text File  |  1989-04-28  |  2KB  |  57 lines

  1. FINDPATH (v1.1) - Where is a file in the PATH or other environment variable
  2.  
  3. I use this program to save typing, as it will "find" the file I am
  4. going to edit.  I simple made an E.BAT, like the one at the bottom of
  5. this file, that lets me edit a file by name (not path).  For example,
  6. to look at the standard C include file, "MALLOC.H", I simply type 
  7. "E MALLOC", and it will edit "H:\LANG\MSC51\INCLUDE\MALLOC.H".
  8.  
  9. This program is Copyright 1989, by David G. Thomas.
  10. I may be reached at the PowerSoft BBS  (404) 928-9294
  11.  
  12. You are free to use this program as you please, and distribute it
  13. to your friends.  I only ask that you do not alter the program, and
  14. you include this file when you pass it on.
  15.  
  16.  
  17. USAGE: 
  18.    FINDPATH name            - Look in PATH for name.bat name.com name.exe
  19.    FINDPATH env_var name    - Look in env_var for name
  20.    FINDPATH env_var name .suf - Look in env_var for name.suf
  21.  
  22. Options (must be first arg)
  23.    -FULL  - Return the fully qualified path
  24.    -SUBST - Return the fully qualified path, chasing SUBST disk
  25.  
  26. The results are placed in the RET environment variable
  27.  
  28.  
  29. E.BAT
  30. ------------------------
  31. @echo off
  32. set editor=b
  33.  
  34. :*  This batch file will edit a file, given only the file name.
  35. :*  If necessary, it will search the INCLUDE and PATH environment 
  36. :*  paths for the file.  Also, a special path named E_PATH is used.    
  37.  
  38. if exist %1 goto use_args
  39.  
  40. findpath E_PATH %1 .c .h .bat .asm
  41. if NOT errorlevel 1 goto frompath
  42.  
  43. findpath INCLUDE %1 .c .h .bat .asm
  44. if NOT errorlevel 1 goto frompath
  45.  
  46. findpath PATH    %1 .bat
  47. if NOT errorlevel 1 goto frompath
  48.  
  49. :use_args
  50.    %editor% %1 %2 %3 %4 %5 %6 %7
  51.    goto end
  52.  
  53. :frompath
  54.    %editor% %RET%
  55.  
  56. :end
  57.