|
Doctor DOS Betamax's |
DOS
|
When using DOS, a number of characters and symbols will
Not all aspects or functions will be addressed. Some are purposed by DOS
in additional ways, but for the most part, these ways, along with characters
not shown, are behind the scenes or are seldom employed by most DOS users. As
such, they will not be considered in this article.
Understand that not everything may apply to your manufacturer
Each of the symbol names will be |
NOTHING IN THIS ARTICLE MAY BE REPRODUCED
WITHOUT PERMISSION FROM THE AUTHOR ©
FOR %N IN (1,2,3) DO ECHO %N.The Comma is used to separate file names for those commands which can accept multiple file specifications.
MOVE FILE-1,FILE-2 C:\ARCHIVESIn many DOS versions, "ECHO," will produce a blank line on the screen.
PKZIP -i BACKUP *.*The `-i' is a switch used to modify the operation of PKZIP. In this case, it requests that PKZIP be selective as to which files it places into the compressed archive. Only those with the "Archive" attribute set will be selected with this example. (See DOS Switches for details on using command modifiers.)
FOR %N IN (1=2=3) DO ECHO %N.With some DOS versions, ECHO= will produce a blank line on the screen.
IF "%1" == "" GOTO HELPmeans that if the first parameter on the command line after the batch file name is equal to nothing, that is, if a first parameter is not given, the batch file is to go to the HELP label.
IF NOT "%1" == "" GOTO ACTIONSSo if the first parameter is not equal to nothing, that is, if it is equal to something, the batch file is to go to the ACTIONS label.
BACKUP <DIR> 11-17-22 9:09p
BACKUP <DIR> 11-17-08 9:09p
PKZIP -i- BACKUP *.*Here, the `-i' switch action has been partially altered by placing a Minus Sign after it as "-i-". It would be read as "dash i minus".
D: ¶ CD \TEMP...would log onto the `D' drive, then move down into the D-Drive's TEMP directory.
IF )%1 == ) ECHO No Parameter GivenParentheses can also be seen in the DIR output on the line giving the number of files in the listing:
40 File(s) 3,465,453 bytes
FOR %F IN (*.BAK) DO DELETE %FThis tells the FOR command to look for each .bak file in the current directory and to delete it. `%F' represents each of the .bak files in turn during the delete process.
FOR %%F IN (*.BAK) DO DELETE %%FThis same example as in the Single Percent explanation tells the FOR command to look for each .bak file in the current directory and to delete it. `%%F' represents each of the .bak files in turn during the delete process.
ECHO DEL %%1 > TEST.BATWhen viewed, the file "TEST.bat" will show this as "%1".
COPY FILE1 + FILE2 + FILE3 BIG-FILEThe Plus Sign is also used to invoke file attributes of Archive, Hidden, Read-Only and System via the ATTRIB command.
?DEVICE=ANSIPLUSBe aware that other DOSes using this feature may require the question mark be placed elsewhere on the line.
DELETE "MY FILE.TXT" FIND "DOS Version" IF "%1" == "OK" GOTO ENDSome versions of DELTREE can use Double Quotes to surround illegal file or directory names in order to delete them.
PATH=C:\BATCH;C:\DOS;C:\UTILThe Semicolon is also used in ANSI "Escape" sequences to separate code strings. (See "Escape", farther back.)
FOR %N IN (1;2;3) DO ECHO %N.Under some DOS versions, "ECHO;" will produce a blank line on the screen.
FOR %N IN (1 2 3) DO ECHO %N.A space can be placed between command-line switches; DOS will still interpret the switches properly. Using spaces in this manner allows for better readability when viewing what is being typed, as well as when viewing batch file source code.
SPRING-BACKUP.TXT becomes SPRING~1.TXT SPRING-BACKUP-FINAL.TXT becomes SPRING~2.TXT
As mentioned at the start, there are additional uses for the
preceding characters; plus there are additional symbols not
discussed here. If you believe there are some that should have
been included, feel free to send an
e-mail with your
suggestions and the reasons for inclusion.
Learning to use these symbols will add to your
DOS tool kit. You will gain extra power at the
command line and within batch files and macros.