MS-DOS [Working With Files] Part 6

Copying Text from the Keyboard to a File

To copy text from the keyboard to a file, first create an unformatted text file by using the copy command followed by CON, as in the following example:
copy con a:note.txt
This command copies whatever you type on the keyboard to the file NOTE.TXT on a disk in drive A. After you type the command, MS-DOS displays a cursor but no command prompt.

If NOTE.TXT doesn't exist on the disk in drive A, MS-DOS creates it. If it does exist, what you type replaces what is already in the file. You need to press ENTER at the end of each line of text you type. When you finish typing into the file, press CTRL+Z and then press ENTER to close the file.

Copying a File to a Printer

To print an unformatted text file, copy it to the port to which your printer is attached, as in the following command:
copy note.txt lpt1
To copy a file to your printer, you can specify as the destination  file the name of the port to which the printer is attached. For example, the following command copies a file named NOTE.TXT on a disk in drive A to the printer attached to the LPT1 port:
copy a:note.txt lpt1
Using CON and the name of a port, you can copy directly from your keyboard to a printer--for example, to the printer attached to the LPT1 port:
copy con lpt1
When you are finished sending information to the printer, press CTRL+Z and then press ENTER to print what you have typed.

Copying Files by Using MS-DOS Shell

If you are using MS-DOS Shell, you can use the Copy command on the File menu to copy any number of files from one directory to another. When you choose Confirm On Replace from the Options menu, MS-DOS prompts you to confirm the command if you are copying over an existing file.

NOTE  When a file or group of files is selected, you use the Copy command on the File menu to copy files. However, when an item from the program list is selected instead, you use the Copy command as a tool for organizing how program items are displayed.

Shell  To copy files:

   Mouse            1. Make sure the file(s) and destination directory (or drive icon) are visible.
                          2. Press and hold down CTRL while you drag the file(s) to the destination directory or drive icon.
                          3. Release the mouse button, and then release CTRL.
                          4. Click the YES button.
  
    Keyboard      1. From the file list, select the file or files you want to copy.
                          2. From the File menu, choose Copy.
                          3. In the To box, type the drive and directory that you want to copy your files to.
                          4. Choose the OK button.


Keyword: Learning MS-DOS | The Complete MS-DOS Commands | MS-DOS tutorial | MS-DOS Script

You may also like: