home *** CD-ROM | disk | FTP | other *** search
/ Zodiac Super OZ / MEDIADEPOT.ISO / FILES / 16 / JCCHDIR.ZIP / BATCH.ZIP / DOALLDIR.BAT < prev    next >
DOS Batch File  |  1996-06-30  |  3KB  |  108 lines

  1. @echo off
  2. :: This is an example-batch file
  3. :: -? for help, or see end of this file
  4. :: see file allCExe for more explanations
  5. ::-------------------------------------------------------------------
  6. ::                                     RECURSION / PROVIDE ENV MEMORY
  7. ::-------------------------------------------------------------------
  8. IF %1.=={. GOTO g
  9. %COMSPEC% /e:2096/d/c %0 { %1 %2 %3 %4 %5 %6 %7 %8
  10. GOTO end
  11. :g
  12.  
  13.  
  14. ::-------------------------------------------------------------------
  15. ::                                                doThis, batFile etc.
  16. ::-------------------------------------------------------------------
  17. set batFile=out.bat
  18. set id=%0
  19.  
  20. shift
  21. ::note, before the shift %1 will obviously  always be {
  22.  
  23. IF %1.==-?. GOTO help
  24. IF %1.==/?. GOTO help
  25.  
  26. IF %1.==. GOTO help
  27.  
  28.  
  29. ::defaults, assume no -n as %1
  30. set doThis=%1
  31. set ini=C.EXE -i
  32.  
  33. IF NOT %1.==-n. GOTO ini
  34.  echo ...%id%  NO ini  [OK]
  35.  set ini=
  36.  shift
  37.  :: ^get rid of %1 which was -n
  38.  set doThis=%1
  39. :ini
  40.  
  41. shift
  42. ::^this  shift skips the current %1 which is now %doThis%
  43. :: both if -n was %1 specified or not
  44. :: clearly, caring about more than say 3 or 4 parameters for matching
  45. :: directories is exaggertated, and this is just meant to serve as an
  46. :: example
  47. ::
  48.  
  49. set noMatchEnding= %temp%\doAllDi$.bat
  50.  
  51. set matchEnding= rem  TEST VERSION: see this file: %batFile%
  52. set pathSet=N
  53.  
  54. ::-------------------------------------------------------------------
  55. ::                                                   CALL child-batch
  56. ::-------------------------------------------------------------------
  57.  
  58. ::create the temporary batch-file which serves as the no-match-ending
  59. echo @echo off                                    >%noMatchEnding%
  60. echo echo ...%%0 %0 aborts... deleting %batFile% >>%noMatchEnding%
  61. echo del %batFile%                               >>%noMatchEnding%
  62.  
  63.  
  64. %COMSPEC% /e:2048/d/c allCexe.BAT %1 %2 %3 %4 %5 %6 %7 %8 %9
  65.  
  66.  
  67. ::delete the temporary batch-file which servedd as the no-match-ending
  68. IF exist %noMatchEnding% del %noMatchEnding% >nul
  69. GOTO end
  70.  
  71.  :help
  72.   cls
  73.   echo %id%
  74.   echo.
  75.   echo  will run %%1 in all directories of the current drive (do not specify a drive)
  76.   echo  Matches for the directories where %%1 is supposed to be run
  77.   echo  can be given with %%2..%%5 (see allcexe for details)
  78.   echo  eg. doAllDir dir/w
  79.   echo      doAllDir dir/w  bak
  80.   echo  The ladder runs "dir/w" in all directories which have exactly the name "BAK"
  81.   echo  on the current drive.
  82.   echo.
  83.   echo  NOTE: As a test version %%1 will not be run immediately.
  84.   echo  Instead %id% will create the batch-file: %batFile%
  85.   echo   (If this doesn't contain a path, then this file is created
  86.   echo    in the current directory - an existing file will be deleted
  87.   echo   )
  88.   echo  HENCE, you can have a look at this batch-file first.
  89.   echo.
  90.   echo %id% will use an ini before it gets going: %ini%
  91.   echo IF you do NOT want this ini, enter -n as the first parameter
  92.   echo and the command as the second
  93.   echo.
  94.   echo NOTE that as always with "c.exe -c" the last parameter would need to
  95.   echo match EXACTLY the directory name.
  96.   echo.
  97.  
  98. :end
  99.  
  100. set batFile=
  101. set doThis=
  102. set id=
  103. set ini=
  104. set noMatchEnding=
  105. set matchEnding=
  106. set pathSet=
  107. ::jC,951107
  108.