Now, let's make a couple of directories so we can put our file away in a place that makes sense to us. The command for making a directory is "md" (for "make directory") and is followed by the name of the directory you wish to make.
· C:\> md dosclass
(to make the directory DOSCLASS)
(to make the directory DOSCLASS)
· C:\> dir
(to view the directory with the new DOSCLASS subdirectory)
(to view the directory with the new DOSCLASS subdirectory)
· C:\> cd dosclass
(to change to the DOSCLASS directory)
(to change to the DOSCLASS directory)
· C:\DOSCLASS> md samples
(to make the directory "samples" inside the DOSCLASS directory)
(to make the directory "samples" inside the DOSCLASS directory)
· C:\DOSCLASS> dir
(to view the directory with the new SAMPLES subdirectory)
(to view the directory with the new SAMPLES subdirectory)
Now that we have created the directories, we can put the practice file we created into the new directory, SAMPLES (C:\DOSCLASS\SAMPLES).
To keep things simple, let's "cd" back to the root directory where the practice file is.
C:\>cd \
And now let's copy that file to the SAMPLES directory which is inside the DOSCLASS directory. In order to copy something, you must first issue the command (copy), then identify the file to be copied (source), and then the directory to which you wish to copy the file (destination).
C:\>copy practice.txt dosclass\samples
A somewhat unfriendly yet useful diagram of the command format would look something like this (where things in brackets are optional).
copy [volume+pathname+]filename [volume+pathname+]directory
There is a slight problem now. The PRACTICE.TXT file was copied into the SAMPLES directory, but there is no reason to have two copies of PRACTICE.TXT. To delete a file, use the DEL command (from "delete") followed by the name of the file.
C:\>del practice.txt
Again, you can delete the file from any directory by including the full pathname.
Z:\>del c:\practice.txt
If you accidentally delete something, there is a possibility of retrieving it using the "undelete" command. This, however, will only work for files just deleted.
C:\undelete
A list of any files that can be undeleted will appear. You will need to replace the first character of the file because DOS removes the first letter of a deleted file (that's how it keeps track of what can be written over).
Like the above commands, you needn't be in the same directory as the file you wish to rename provided you include the pathname of the file you wish to change. But the second argument of this command, the new filename, will not accept a pathname designation. In other words, the second argument should just be a filename (with no pathname):
C:\>ren \dosclass\samples\practice.txt prac.txt
Parent directory (..)
If you wish to move up one level in the hierarchy of the file structure (change to the parent directory), there is a shortcut--two consecutive periods: ".."
If you wish to move up one level in the hierarchy of the file structure (change to the parent directory), there is a shortcut--two consecutive periods: ".."
C:\DOSCLASS\SAMPLES>cd ..
This works in a pathname as well:
C:\DOSCLASS\SAMPLES>ren ..\practice.txt prac.txt
If the file PRACTICE.TXT were in the directory above SAMPLES (the DOSCLASS directory), the above command would change it to PRAC.TXT.
F3
The F3 function key can be a time saver if you're prone to typos. Pressing the F3 button will retype the last command for you.
The F3 function key can be a time saver if you're prone to typos. Pressing the F3 button will retype the last command for you.
Breaking
Sometimes, you may start a procedure such as a long directory listing and wish to stop before it is completed. The Break command often works when running batch files and other executable files. To stop a procedure, press [CTRL] + [BREAK]. [CTRL] is located in the lower right-hand corner of the keyboard. [BREAK] is located in the upper right hand corner of the keyboard and is also labeled [PAUSE].
Sometimes, you may start a procedure such as a long directory listing and wish to stop before it is completed. The Break command often works when running batch files and other executable files. To stop a procedure, press [CTRL] + [BREAK]. [CTRL] is located in the lower right-hand corner of the keyboard. [BREAK] is located in the upper right hand corner of the keyboard and is also labeled [PAUSE].
Wildcards (*) and (?)
Another benefit of the command-prompt interface is the ability to use wildcards. If you want, for example, to copy only files with the .txt extension, you employ a wildcard:
Another benefit of the command-prompt interface is the ability to use wildcards. If you want, for example, to copy only files with the .txt extension, you employ a wildcard:
C:\>copy *.txt a:\backup\txtfiles
Viewing
Text files, on the other hand can be viewed quickly with the type command:
C:\>cd dosclass\samples
C:\DOSCLASS\SAMPLES>type practice.txt | more
C:\DOSCLASS\SAMPLES>type practice.txt | more
Editing
Or you can view the file in the provided text editor (just as we did when we first created practice.txt):
C:\DOSCLASS\SAMPLES>edit practice.txt
Printing
If you want to send a text file to the printer, there is the print command. But there are two steps:
C:\DOSCLASSES\SAMPLES>print practice.txt
Name of list device [PRN]: lpt2
Name of list device [PRN]: lpt2
If you wish to print to a networked printer, usually lpt2 is the correct response. For local printers, the correct response is usually lpt1.

0 comments:
Post a Comment