home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 26
/
CD_ASCQ_26_1295.iso
/
vrac
/
rbatch13.zip
/
RBATCH13.BOK
< prev
next >
Wrap
Text File
|
1995-08-01
|
314KB
|
8,369 lines
╔════════════════════════════════════════════════════════╗
║ ║
║ ▐██▌▐▌▐▌▐▌ █ ▐██▌ ▐▌ ▐██▌ ▐██▐▌▐▌ ▐██▌▐▌▐▌▐▌ █ ║
║ █ █▐▌▐▌▐█ █ █ █ ██ ▐▐▌▌ █ █▐▌▐▌ █ █▐▌▐▌▐█ █ ║
║ █ █▐▌▐▌▐█▌█ █ █▐▌▐▌ ▐▌ ▐▌ ▐▌▐▌ █ █▐▌▐▌▐█▌█ ║
║ ██▌▐▌▐▌▐▌██ ██▌▐▌▐▌ ▐▌ ▐▌ ▐██▌ ██▌▐▌▐▌▐▌██ ║
║ ██ ▐▌▐▌▐▌▐█ █ █▐██▌ ▐▌ ▐▌ ▐▌▐▌ ██ ▐▌▐▌▐▌▐█ ║
║ █▐▌▐▌▐▌▐▌ █ █ █▐▌▐▌ ▐▌ █ █▐▌▐▌ █▐▌▐▌▐▌▐▌ █ ║
║ ▐█ █ ██ ▐▌ █ ▐██▌▐▌▐▌ ██ ▐█▌▐▌▐▌ ▐█ █ ██ ▐▌ █ ║
║ ║
║ ║
╚════════════════════════════════════════════════════════╝
The Run Batch Run Book
Copyright (c) 1995, Finn Roaas
All Right Reserved, World Wide
Finn Roaas
Ole Reistads vei 39 D
N-1068 Oslo, Norway
finnr@oslonett.no
=====================================
RUN BATCH RUN REGISTRATION FORM
=====================================
Remit to: Finn Roaas
Ole Reistads vei 39 D
N-1068 Oslo, Norway
---------------------------------------------------------------------
| Item | Quantity | Price | Total |
|-------------------------------|----------|----------- |------------|
| RBatch12 version 1.2 (Nor) | ________ | NOK100.00 | __________ |
| | | | |
| RBatch13 version 1.3 (Eng) | ________ | $ 12.00 | __________ |
| (A Companion Disk included) | | | |
| Diskette 3.5 ( ) 5.25 ( ) | ________ | $ 8.00 | __________ |
| | | NOK 50.00 | |
| Schools (free use 1000 | | | |
| students for one year | ________ | NOK1.000,00| __________ |
| Subscription | | $ 80.00 | |
| Abonnement | ________ | NOK480.00 | __________ |
| | | | |
| Shipping | ________ | $ 5.00 | __________ |
|------------------------------------------------------ |------------|
| | |
| Total amount enclosed | __________ |
----------------------------------------------------------------------
Payment by: ( ) Check or money order
( ) American Express
( ) Diners Club
( ) MasterCard
( ) Visa
( ) PO # ______________
Card #: ____________________________________ Exp. Date: _________
Signature of card holder: ____________________________________________
Name: ________________________________________________________
Company: ________________________________________________________
Address: ________________________________________________________
________________________________________________________
________________________________________________________
Phone: ________________________________________________________
( ) Check or money order payable to Finn Roaas in U.S. funds enclosed
( ) SWIFT transfer to 6065.56.31588 (Kredittkassen 1067 Oslo, Norway)
( ) SWIFT transfer to 0521 1589665 (Postbanken, Norway)
TABLE OF CONTENTS
=================
Chapter 1: Save your files - different methods
Chapter 2: One day you will regret that you didn't take backup seriously
Chapter 3: How to make a choice about how a batch should proceed?
Chapter 4: Edit a batch program
Chapter 5: Batch pipe problem
Chapter 6: Searching for files is often time consuming
Chapter 7: Customizing the command dir
Chapter 8: How can a batch program answer Y for yes
Chapter 9: Batch files can be used with memory and RAM
Chapter 10: To remove files accidentally extracted
Chapter 11: Choice
Chapter 12: How to get the system date
Chapter 13: Extracting text strings
Chapter 14: Different batch enhancers and using scan codes
Chapter 15: Batch files and mail
Chapter 16: How to suppress the writing on the screen?
Chapter 17: How to have a batch file testing if Windows is running
Chapter 18: Invisible cursor
Chapter 19: Numbered repeats in batch files
Chapter 20: How you can write batch files that will execute
certain commands based on the time of day?
Chapter 21: Return to directory
Chapter 22: Make a log with the time and date
Chapter 23: Books, magazines and programs about batch files
Chapter 24: Remove file comment
Chapter 25: FOR in batch files
Chapter 26: Ansi codes in batch file
Chapter 27: About errorlevel
Chapter 28: Rebooting from a batch file
Chapter 29: How to execute a batch file on a certain weekday?
Chapter 30: Y/N in batch files
Chapter 31: Remap keys
Chapter 33: Detecting DblSpace drive
Chapter 34: How to add a path to the existing path?
Chapter 35: Numlock on
Chapter 36: Changing the date during execution
Chapter 37: Undocumented commands
Chapter 38: Ctrl-c/break
Chapter 39: Can't delete directory
Chapter 40: Batch file for cd-rom
Chapter 41: Get the beep out of CHOICE
Chapter 42: How to tell MS DOS not to display any messages?
Chapter 43: How to dump binary files to readable ASCII text?
Chapter 44: A keyboard macro program
Chapter 45: Alternative decoder to using DOS DEBUG
Chapter 46: Increasing file size
>>>>@@@@<<<<
Chapter 1: Save your files - different methods.
===============================================
At the end of this book you will find a presentation of the
the author. As you will see I'm also a novelist and
a writer of modern norwegian literature.
I know how important it is to save my files in a secure
and efficient way. The day you have lost important data
you will understand the importance of taking good care
of all files you produce. When your hard disk is down
and one year's work is wasted it is to late to plan
how you are going to save your files.
Some years ago I lost all chapters in a new book I was
writing because of problems with my WC-card. A lot
of different thoughts went through my head when I
realized what had happened, but fortunately I also
remembered that I had copied the files to a floppy.
I looked through my diskettes and thank God I found what
I was looking for. The floppy made it possible to restore
all files to my hard disk.
As I said, this happened many years ago. Experience has taught me
the lessons to take good care of my files. This is our first subject.
Let's have a closer look at a batch file I have called
SAV1.BAT
========
@ECHO OFF
:start
IF " %1" ==" " GOTO end
ECHO ***%1 will be saved ***
IF NOT EXIST A:%1 COPY %1 A:
SHIFT
GOTO start
:end
Every day when I had finished writing a manuscript, essays
or letters, I needed to save the files to a floppy.
The files had different names and I wanted to make a program
that was able to copy more than 9 files. I knew that %1 to %9
parameters gave me the opportunity to run nine variables
through a batch program, but it was not enough. Then I
discovered SHIFT. The command allowed me to use more than nine
batch parameters.
The SHIFT command moves the parameters one step to the left
in a batch file. It moves the remaining parameters down one
value, a new %9 is brought in if any exists. In the example
above I use the SHIFT command with three parameters. When a
SHIFT command is executed, it moves the %3 parameter down to
the %2 parameter. The value %2 moves into %1. The original %1
has disappeared. After executing another SHIFT command, the
original %3 has become %1, and the original %2 and %3 are both
gone.
The SHIFT command makes it possible to make a short batch
program to execute any number of parameters. The batch file
above illustrates this method. SAV1.BAT may be used to backup
any number of files. Below you will find a description of how
the file works, line by line.
The first line turns off the echoing with the command
ECHO OFF.
The label :START in line 2 marks the start of the command
and will be repeated for each parameter.
In line 3 the IF command tests if it exists a parameter in
the variable %1. The command makes a comparison between
%1 and the double quotation marks enclosing nothing (" "). This
is called an empty string. You ask MS DOS to compare the first
parameter with nothing or with an empty parameter. If the
comparison is true, the GOTO command ends at the label :end.
The ECHO command in line 4 shows the name of the file being
copied.
The IF command in line 5 lets your batch file test if the
files you save exists on the diskette in A. If it not exists
the COPY command copies the file from the active drive and
directory to A:.
In line 6 the SHIFT command moves parameters one step to the
left.
The GOTO command in line 7 returns MS DOS to :START.
The label :end in line 8 marks the end of the of the batch file.
You run SAV1.BAT with the following command line:
C:\> SAV1.BAT autoexec.bat config.sys command.com
The batch file ends when %1 is equal to " " - or in another
words - when it is no files left to copy. But the batch file
won't stop. It displays this message:
Syntax error
*** will be saved ***
A: File not found
0 File(s) copied.
The quickest way to end the program is to press CONTROL - C.
The command has the following syntax:
SAV1 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14
I usually name my manuscripts, essays and letters with,
short abbreviations like CHAP1 etc.
The end of the batch program above is far from
impressing. But as long as you use the correct
syntax and the file exists the job is done.
Immediately you write a filename that does not
exit or the file does not exist, you'll get an
error message.
When the job is done, the SHIFT command runs in loop.
I finish with Control-C. Not very elegant, but
SAV1.BAT gives you an idea how the SHIFT command
works.
SAVE.BAT
========
@ECHO OFF
CLS
REM PRESS THE TAB WHEN ECHO IS DONE
ECHO *** SAVE ***
ECHO.
ECHO Have you inserted the floppy in drive A:
REM The warning will not be displayed if already saved
IF NOT EXIST A:%1 GOTO ready
ECHO
REM CTRL-G creates i bip
ECHO
a:%1 exists. Press CTRL-BREAK to terminate, or...
PAUSE
:ready
COPY %1 a:%1
IF EXIST A:%1 erase %1
ECHO
ECHO %1 has been saved to the diskette!
I have always been looking for good methods to
protect and save my work, but I have also been
looking for ways to control the performance.
In long periods I have made use of the batch program
above. Only when a certain condition exists or come true,
for example a certain file exists, the command will be
issued. I noticed immediately that the method improved
my batch files. The method may be used in many different
situations, what you will find in this book. The IF
command is used when you want a batch command to be
carried out only after certain conditions have been met.
For example, the following command starts Qedit when Q
is used as a parameter:
IF "%1"=="Q" D:\QE3\Q
The command use three parameters:
IF (NOT) <condition> <command>