home *** CD-ROM | disk | FTP | other *** search
- @echo off
- :: This file is an example-batch-file
- :: -? for help, or see end of this file
- :: see file allCExe for more explanations
- ::-------------------------------------------------------------------
- :: ID, COMMAND, batFile etc.
- ::-------------------------------------------------------------------
- set batFile=%temp%\test.bat
-
- set id=dupTree
- set doThis= mkDir %2%%p%%
- ::note %2 is substitued in this batch, and %%p%% NOT - %%p%% will
- ::be converted to %p% which will then be exampined in the created
- ::batch-file:
- :: eg: %0 c:\ g:\bak\c
- :: -> mkdir g:\bak\c%p%
- ::best to run this file with -?, then enter an example and have
- ::a look at the created file %temp%\test.bat
- :: Note - the above won't work with the root since the \ add up to \\
- :: (invalid)
- ::
-
- set pathSet=Y
-
- set ini=C.EXE -i . %1
- ::^ini all dir-paths from the source downwards (given as first parameter)
-
-
- IF %1.==-?. GOTO help
- IF %1.==/?. GOTO help
-
-
- IF %2.==. echo ...ERROR: two parameters
- IF %2.==. pause
- IF %2.==. GOTO help
-
- IF exist %temp%\%id%.LST del %temp%\%id%.LST
- ::^as the actual batch-file %batFile% is going to APPEND ( $g$g => >> )
- :: delete this file. Note, that the actual batch file does not delete
- :: this %id%.lst file itself. This could be achieved, if eg. the above delete
- :: command was inserted at the start of this file with eg:
- GOTO skip1
- echo @IF exist %temp%\%id%.LST del %temp%\%id%.LST >%temp%\%id%.LST
- ::^first line, > deletes an exisiting file
- type %batFile% >>%temp%\%id%.LST
- ::^ append batch-file to it
- copy %temp%\%id%.LST %batFile% /y >nul
- ::^ copy this appended file back over the original batch-file
- IF exist %temp%\%id%.LST del %temp%\%id%.LST >%temp%\%id%.LST
- ::^ delete the temporary appended file // (just for the exercise)
- ::
- :skip1
-
- ::-------------------------------------------------------------------
- :: allCExe.BAT
- ::-------------------------------------------------------------------
- %COMSPEC%/e:2048/d/c allCExe.BAT
-
- ::echo echo ...file: %temp%\%id%.LST >> %batFile%
- ::^append this command to the batch-file %batFile%
- :: BTW: this is displayed twice, which might highlight the "recursive nature"
- :: of the involved batch-file - note therefore that the end of a file
- :: is no place to but 28423498 commands, since they would all be run
- :: twice - UNLESS you avoid this of course. eg. with:
- GOTO end
- ...just an example: these lines are "not part of" this batch-file
-
- @echo off
- IF %1.=={. GOTO g
- command/e:2096/d/c%0 { %1 %2 %3 %4 %5 %6 %7 %8
- IF %p%.==. GOTO trueHalt
- GOTO h
- ...etc...
- IF ... GOTO h
- ...etc...
- IF ... GOTO trueHalt
- ...etc...
- :h
- set p=
- set d=
- echo ...file: I:\tmp\allBak.LST
- :trueHalt
-
-
- or the likes
-
- ::-------------------------------------------------------------------
- :: HELP
- ::-------------------------------------------------------------------
- :help
- cls
- echo.
- echo %id% DUPLICATE TREE
- echo.
- echo Uses allCexe.bat, creates a batch file: %batFile%
- echo The command is: %doThis%
- echo.
- echo Two parameter must be given.
- echo first: the start directory, eg. c:\ to start in the root of C:
- echo second: the target directory
- echo eg: %0 c:\ e:
- echo eg: %0 c:\ g:\bak\c
- echo will create all directories below c:\ on g:\bak\c
- echo g:\bak\c must be an exisiting directory and MUST NOT
- echo end with a \ (backslash)
- echo.
- echo An initialization for the source will be run. (c -i .)
- echo Note: Do not enter more than the batch-name (i.e. no .bat at the end)
- echo.
- echo NOTE carefully, you can run this batch %0 "without any risk", and
- echo examine its "output": %batFile%
- echo %id% will not start %batFile% automatically.
- echo.
- GOTO end
-
- :end
-
- ::-------------------------------------------------------------------
- :: RESET ENV VARs
- ::-------------------------------------------------------------------
-
- set batFile=
- set doThis=
- set id=
- set ini=
- set pathSet=
-
- ::jC,951107
-