home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1995 November
/
PCWK1195.iso
/
inne
/
podstawy
/
dos
/
4dos
/
4uzytki
/
ez-btm11.exe
/
COMFILE.BTM
< prev
next >
Wrap
Text File
|
1994-03-30
|
2KB
|
77 lines
:COMFILE.BTM (=execute a command on a take file)
: Itamar Even-Zohar, Tel Aviv University (itiez@ccsg.tau.ac.il)
: (See detailed description below, :description, or type COMFILE h)
: The loops have not been re-written with the new version 5.x options.
if "%&"=="" goto syntax
if "%1"=="h" goto description
:checkfile
iff not exist %1 then^echo %@upper[%1] not found^quit^endiff
:lines
setlocal
set lines=%@LINES[%1]
set linenum=%@eval[%LINES+1]
echo There are %linenum lines in %@upper[%1]
echo.
echo.
set counter=0
set num=0
:loop
if %counter gt %lines goto loopdone
set curline=%2 %@line[%1,%num] %3
%curline
set counter=%@eval[%counter + 1]
:Set lines=%@eval[%lines - 1]
set num=%@eval[%num + 1]
goto loop
:loopdone
echo.
echo Command "%@upper[%2]" executed for all %linenum files
endlocal
quit
::-------------- Description and HELP --------------------
:syntax
cls
screen 2 0
text
SYNTAX:
COMFILE filename command [target]
Reads a specified file which contains a list of filenames, and executes
desired operation on each of the filenames, one by one.
EXAMPLE:
COMFILE FILELIST COPY A:
will copy all files specified in FILELIST to drive A:
For further details type COMFILE h
endtext
quit
:description
cls
screen 1 0
text
COMFILE.BTM works as follows: it first finds out how many lines
are contained in the specified file. It then puts the first line
with the desired command, and goes to the next, until it exhausts
all lines. It starts with counter "0", adding 1 with each line.
When the counter is greater than the number of lines (counted
from the second line, which is registered as "1" by 4DOS), the
program stops. Note that version 5.x of 4DOS allow more elegant
loops.
Note:
COMF.BTM executes the same operation with more elegant procedures.
endtext
quit