home *** CD-ROM | disk | FTP | other *** search
- @echo off
- :: This is an example-batch file
- :: -? for help, or see end of this file
- :: see file allCExe for more explanations
- ::-------------------------------------------------------------------
- :: RECURSION / PROVIDE ENV MEMORY
- ::-------------------------------------------------------------------
- IF %1.=={. GOTO g
- %COMSPEC% /e:2096/d/c %0 { %1 %2 %3 %4 %5 %6 %7 %8
- GOTO end
- :g
-
-
- ::-------------------------------------------------------------------
- :: doThis, batFile etc.
- ::-------------------------------------------------------------------
- set batFile=out.bat
- set id=%0
-
- shift
- ::note, before the shift %1 will obviously always be {
-
- IF %1.==-?. GOTO help
- IF %1.==/?. GOTO help
-
- IF %1.==. GOTO help
-
-
- ::defaults, assume no -n as %1
- set doThis=%1
- set ini=C.EXE -i
-
- IF NOT %1.==-n. GOTO ini
- echo ...%id% NO ini [OK]
- set ini=
- shift
- :: ^get rid of %1 which was -n
- set doThis=%1
- :ini
-
- shift
- ::^this shift skips the current %1 which is now %doThis%
- :: both if -n was %1 specified or not
- :: clearly, caring about more than say 3 or 4 parameters for matching
- :: directories is exaggertated, and this is just meant to serve as an
- :: example
- ::
-
- set noMatchEnding= %temp%\doAllDi$.bat
-
- set matchEnding= rem TEST VERSION: see this file: %batFile%
- set pathSet=N
-
- ::-------------------------------------------------------------------
- :: CALL child-batch
- ::-------------------------------------------------------------------
-
- ::create the temporary batch-file which serves as the no-match-ending
- echo @echo off >%noMatchEnding%
- echo echo ...%%0 %0 aborts... deleting %batFile% >>%noMatchEnding%
- echo del %batFile% >>%noMatchEnding%
-
-
- %COMSPEC% /e:2048/d/c allCexe.BAT %1 %2 %3 %4 %5 %6 %7 %8 %9
-
-
- ::delete the temporary batch-file which servedd as the no-match-ending
- IF exist %noMatchEnding% del %noMatchEnding% >nul
- GOTO end
-
- :help
- cls
- echo %id%
- echo.
- echo will run %%1 in all directories of the current drive (do not specify a drive)
- echo Matches for the directories where %%1 is supposed to be run
- echo can be given with %%2..%%5 (see allcexe for details)
- echo eg. doAllDir dir/w
- echo doAllDir dir/w bak
- echo The ladder runs "dir/w" in all directories which have exactly the name "BAK"
- echo on the current drive.
- echo.
- echo NOTE: As a test version %%1 will not be run immediately.
- echo Instead %id% will create the batch-file: %batFile%
- echo (If this doesn't contain a path, then this file is created
- echo in the current directory - an existing file will be deleted
- echo )
- echo HENCE, you can have a look at this batch-file first.
- echo.
- echo %id% will use an ini before it gets going: %ini%
- echo IF you do NOT want this ini, enter -n as the first parameter
- echo and the command as the second
- echo.
- echo NOTE that as always with "c.exe -c" the last parameter would need to
- echo match EXACTLY the directory name.
- echo.
-
- :end
-
- set batFile=
- set doThis=
- set id=
- set ini=
- set noMatchEnding=
- set matchEnding=
- set pathSet=
- ::jC,951107
-