home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
batutl
/
atsign.arc
/
@.DOC
next >
Wrap
Text File
|
1986-07-21
|
5KB
|
128 lines
page 1
------------------------------------------------------------
| @ AN IMMEDIATE BATCH UTILITY Rev. 1.0, 12/16/85 V.Bly |
| |
| Send comments, criticisms, and small contributions to: |
| Vince Bly, Nanosoft, P.O. Box 409, Ft. Belvoir, VA 22060 |
------------------------------------------------------------
PURPOSE
Provides an immediate batch mode where several commands may be
entered on a single DOS command line. Each command will be
executed in sequence. Provides many of the capabilitys of batch
files without the necessity of creating a batch file. It also
can be used to enhance batch files, providing redirection of the
output of a batch file and enhancing the batch FOR...DO command.
FORMAT
@ [option(s)] command [arg(s)] @ command [arg(s)] @ command [arg(s)]...
Example: @ ~e copy *.bas c:\backups @ copy *.bas a: @ dir *.bas.
OPTIONS
~E echo on (echo may be redirected).
~S echo to screen (echo not redirected).
~N no changing of {, !, and } to <, |, and >. See REDIRECTION.
SPECIAL COMMAND (PZ)
The internal command pz waits for <SPACE> to cont. or <BREAK> to abort.
ERROR
Errorlevel is not (and cannot) be supported. See NOTES.
REDIRECTION
GLOBAL redirection uses the standard <, |, and > symbols.
Example: @ dir a: @ dir b:>ab.dr creats one file ab.dr with
directories of drives A & B.
LOCAL redirection uses the { ! and } symbols.
Example: @ dir a:}a.dr @ dir b:}b.dr creats two files, a.dr
has the directory of A and b.dr has the directory of B.
@ WITH BATCH FILES
@ can be used to redirect the output of a batch file or expand
the batch FOR...DO command.
Assume that you have a batch file called TWODIR.BAT, like the
following:
ECHO OFF
DIR %1
DIR %2
Issuing the command: TWODIR *.BAS *.BAT>NEWDIR.TXT will display
directories of all .BAS files then all .BAT files, but they will
not be redirected to the text file NEWDIR.TXT. However, issuing
the command: @ TWODIR *.BAS *.BAT>NEWDIR.TXT will creat a text
file containing both directories.
page 2
@ WITH BATCH FILES (continued)
The batch FOR...DO command is potentially very powerful; however,
only a single command can follow the DO. It could, for example,
be used to copy all *.PAS files to drive C:, but there is no way
to select which .PAS files are copied. @ can be used to expand
the FOR...DO command since an @ string appears as one command to
the batch processor. As an example, type in the following batch
file named DUP.BAT.
ECHO OFF
FOR %%F IN (%2) DO @ @ ECHO %1 %%F %3 ? @ PZ @ %1 %%F %3 @ PAUSE
Now, assuming you have several .BAT files in the current directory,
issue the command: DUP TYPE *.BAT
If you have entered everything correctly, you will now be asked,
sequentially, if you want to type each .BAT file. For each .BAT
file in the directory, you should see a display like:
TYPE MYOWN.BAT ?
Press <SPACE> to continue or <BREAK> to exit...
If you want to see the contents of MYOWN.BAT, press the <Space>
bar, otherwise press <Ctrl><Break> once and you will skip to the
next .BAT file. Press <Ctrl><Break> twice in succession to exit
the DUP batch file.
The first two @'s, separated by a space, produce an extra blank
line. Responding with <Break> to the PZ command exits the current
@ sequence, skipping to the next iteration of the FOR..DO loop.
The DUP.BAT batch program can be used to selectively operate on
any members of a wildcard set (such as *.COM, A.*, etc.) with
any DOS command as long as the wildcard set does not include path
names (the FOR..DO command [pre-DOS 3.0] cannot process paths).
For example: DUP COPY *.BAS C:\BASBACKS. For maximum speed using
DUP, see the comments on changing the location of COMMAND.COM in
the NOTES below.
NOTES
@ can only be used with DOS 2.0 or later. The maximum length of
an @ string is 127 characters.
@ operates by envoking a secondary copy of the command processor
for each command. It finds the processor by examining the current
environment (looking for COMSPEC=processor location and name).
@ cannot process error return codes since the codes are returned
to the secondary processor and are not readily available to the
primary processor which is executing @.EXE.
If you use a ram disk, you can speed the operation of @ strings
(and other programs) by copying command.com to your ram disk and
setting its new location in the environment. As an example, let's
assume that your ram disk is designated as drive D: and you booted
from your hard disk, drive C:, then you would proceed as follows:
COPY C:\COMMAND.COM D:\
SET COMSPEC=D:\COMMAND.COM
Now, whenever command.com is reloaded, it will be loaded from your
ram disk instead of your hard disk. WARNING, if you need to format
a disk using the /S option, you will need to reset command.com to
its original location (where the hidden files ibmbio.com and
ibmdos.com are located). For example: SET COMSPEC=C:\COMMAND.COM.