2.9
Using COPY CON to Build a File
Typical Operations
In this
activity you use the COPY command to create files. Begin at the DOS prompt. If
you are using a hard disk system with a single floppy drive, substitute drives
A for B in the following procedures.
1. Place a formatted disk in drive B and close the load lever.
2. Type COPY CON: B:FILE and press Return.
3. Type the following text, ending each line
with Return. Press Ctrl-Z and then press Return
on the last
line to obtain ^Z character.
This is file number one.
It contains three lines.
^Z
4. Type COPY B:FILE1 CON: and press Return;
notice that your new file is displayed on the
console(screen).
2.10
Introduction to Simple Batch Files
How
do I write batch programs:
Geez, do I
have to answer this? But people ask... You'd be surprised how many people are
in that narrow transition period of knowing how to type commands, but not
knowing how to put them together in a batch file. Here is the short version:
Get yourself a DOS prompt. Type in the commands you need to do whatever it is
you need to do. If your commands work, open up Notepad and type those SAME
COMMANDS in the SAME ORDER. Don't type what appeared on the screen, just type
what you actually typed in. Save that file with a bat extension (For example
"test.bat"). Now instead of having to type the commands, you can just
double-click the batch file. Sure, your first batch file may only have two or
three commands, but it counts. It's a batch program.
BATCH
FILE ABCs
Batch files
are programs that all MS-DOS users can create to help do long tasks fast. Such
as opening certain programs ran frequently, deleting or managing files, etc.
Simple batch files do not require any special programming skills and usually
can be done by knowing the below commands and or just DOS commands.
A prime
example of a batch file for someone whom may know more about Windows or MacOS
would be relating a batch file to a shortcut in Windows or with the
MacOS, A
batch file like a shortcut is a small file which is used to run frequently
accessed programs.
Another
example of a very well known batch file is the autoexec.bat, which is simply a
boot file loaded each time the computer is loaded within this file contains
various lines to load various programs and drivers into memory.
CREATING
A BATCH FILE
To create a
basic batch file first get to a MS-DOS command prompt and follow the below
instructions:
1. At the MS-DOS prompt type
edit test.bat and press enter.
2. If
typed properly you should now be in a blue screen within the blue screen
type:pausedir
c:\windowsdir c:\windows\system
3. Once
the above three lines have been typed in the blue screen choose file and choose
exit, when prompted to save click yes
4. Once
you are back at the prompt type test. When you press enter this should execute
the test.bat file and
begin running the file. Because the first line is pause you will first be
prompted to press a key. Once you press a key the batch file will run line by
line in this case listing the files in the windows and windows\system
directory. If you wish to add more lines to this batch file you would simply
type edit test.bat again to edit the file.
|