One Morning around 2:00 AM, I was online being bored, so I checked out Totse, I figured I should just read through some old textfiles, then I came across the DOS section and damn, there was nothing, so I was like what the hell, let's put a lil' file there, so here it is, hope you enjoy, "Simple DOS Commands"
It is possible to lose files by mistake, although the more you practice the less likely it becomes. For your own peace of mind, it is good practice to make backup copies of your most valuable files on a separate diskette. Store your backup disk in a safe place and don't carry it through a metal detector. Use the COPY command to create the backup.
There is no need to backup every file you create, only the ones in which you've invested much work. Also, prune your backup diskette every week or two using the ERASE command. Backup files which have been made redundant by subsequent additions will simply create clutter on your backup diskette. An effective file naming convention is essential to keeping track of your backups.
Change the Default Drive
To change the default drive, simply type the letter of the your choice. The new default will be listed in subsequent DOS prompts.
C> A: [enter]
Changes the default drive from C to A.
A> C: [enter]
Changes the default drive from A to C.
[enter] means that you must press the Enter Key before the format command will execute. [Enter] is required after any DOS command, it is assumed in all commands found below.
CHDIR (CD) Change Directory Command
Once you have located the directory you want, you may move from directory to directory using the CD command (change directory)
C> cd furniture
Moves you to the directory called 'FURNITURE'
C> cd \furniture\chairs
Moves you to the directory called 'CHAIRS' under the directory called 'FURNITURE'.
C> cd ..
Moves you up one level in the path.
C> cd \
Takes you back to the root directory (c: in this case).
The COPY command can be used both to copy files from disk to disk or to create a second copy of a file on a single disk. (There are many more uses of the COPY command, but only the basic operation is discussed here.)
C> copy c:kermit.exe a:
Copies the file 'KERMIT.EXE' from the C drive to the A drive and gives it the same name.
C> copy a:brazil1.dat b:\south\brazil2.dat
Creates a copy of 'BRAZIL1.DAT' from drive A on drive B, putting it in the 'SOUTH' subdirectory and renaming it 'BRAZIL2.DAT'.
The key to use this command correctly is to remember that the first file specified after the COPY command is the source file, the second is the target:ehp1 file. The source is the file to be copied. The target will be the location and name of the new file. If the file name and extension are omitted after the target's drive specification, the new file will have exactly the same name as the source file.
C> copy a:myfile.txt b:
C> copy c:command.com b:com.com
C> copy b:golly.gee a:whao.boy
C> copy command.* a:
C> copy a:mymap.dwg c:\maps
Note: it is always good practice to us the complete file specifications for both source and target files, Be very sure of yourself before you accept defaults or employ wild-card characters. Otherwise you may end up with some interesting results. Incomplete or incorrect source names may result in errors, such as the command: copy edlin a:myomy.bat. Try it and see what happens.
DIR (Directory) Command
The DIRECTORY command lists the names and sizes of all files located on a particular disk.
C> dir a:
Shows directory of drive A
C> dir b:
Shows directory of drive B
C> dir \agis
Shows files in a subdirectory on drive C (default)
Shows directory of drive C
C> dir /w
Shows directory in wide format, as opposed to a vertical listing.
All the files are listed at the screen, you can stop the display by typing CTRL-BREAK. If you ask for a directory on the A or B drives, be sure there is a diskette in the drive and that the diskette has been formatted. If the drive is empty, or if the diskette is unformatted, the DOS will respond with an error message.
Two little characters, '*' and '?', will make your life with computers much easier. Their use is illustrated below.
C> dir a:*.ex
Lists all files on the A drive with an extension of 'EXE'.
C> dir b:kermit.*
Lists all files on the B drive with a filename of 'KERMIT'.
The asterisk is a wild-card character which allows the user to enter only a limited part of a file specification to find a file. It is useful when you wish to locate a group of files with the same filename or the same extension. On other occasions you may have forgotten part of a file specification. You can use '*' in place of the parts of the specification you have forgotten. Similarly, '?' permits wild-card searches keyed to single characters.
C> dir a:labe?.com
Lists all five-letter files with the first four letters 'LABE' and an extension of 'COM'.
C> dir b:format.c??
Lists all files with a filename of 'FORMAT' and an extension beginning with 'C'.
Wild-card characters can be used in combination.
C> dir a:labe?.*
Lists all five-letter files with the first four letters 'LABE' and any extension.
C> dir c:*.ex?
Lists all files with an extension beginning with 'EX'.
Experiment with '*' and '?' to improve your ability to find files quickly. These wild-card characters can also be used with several other DOS commands.
The ERASE command deletes specified files.
C> erase a:myfile.txt
Erases the file MYFILE.TXT from the diskette in the A drive. If no drive specification is entered, the system looks to delete the specified file form drive C (in this case).
IMPORTANT WARNING: This command is easy to use, but it is the most dangerous one you will encounter in DOS (apart form FORMAT). If you aren't careful, you may delete a file which you--or someone else--needs. And, unless you have saved a backup of that file, the erased file is gone for good. For this reason it is good practice to use only complete file specifications with the ERASE command (and to keep backups of your most valuable files). As a safety precaution, never use the wild-card characters '*' and '?' in ERASE commands.
BEWARE: I will rescind your laboratory privileges for a full week if you ever knowingly use either the command: erase c:*.*, or the command: erase *.*. Guess what happens?
Careful file naming can save time. Always choose names which provide a clue to the file's contents. If you are working with a series of related files, use a number somewhere in the name to indicate which version you have created. This applies only to the filename parameter; most of the file extension parameters you will be using are predetermined (or reserved by DOS for certain types of file).
An ATLAS*GRAPHICS file containing data for a world map. The DAT extension is required by ATLAS*GRAPHICS.
A boundary file of Brazil in binary form.
Three versions of a data file for a map of Britain.
You must format new disks before using them on the IBM computers. The format command checks a diskette for flaws and creates a directory where all the names of the diskette's files will be stored.
C> format a:
Formats the diskette in the A drive.
C> format b:
After entering this command, follow the instructions on the screen. When the FORMAT operation is complete, the system will ask if you wish to FORMAT more diskettes. If you are working with only one diskette, answer N (No) and carry on with you work. If you wish to FORMAT several diskettes, answer Y (Yes) until you have finished formatting all your diskettes.
BEWARE: Executing the format command with a diskette which already contains files will result in the deletion of all the contents of the entire disk. It is best to execute the format command only on new diskettes. If you format an old diskette make sure it contains nothing you wish to save.
MKDIR (MD) Make Directory Command
This command creates a new directory.
C> mkdir mine
Creates a directory called 'MINE'
Rebooting the computer (Ctrl-Alt-Del)
In some cases, when all attempts to recover from a barrage of error messages fails, as a last resort you can reboot the computer. To do this, you press, all at once, the control, alternate and delete.
BEWARE: If you re-boot, you may loose some of your work--any data active in RAM which has not yet been saved to disk.
RENAME (REN) Command
The RENAME command permits users to change the name of a file without making a copy of it.
C> ren a:goofy.txt pluto.txt
Changes the name of 'GOOFY.TXT' on the A drive to 'PLUTO.TXT'.
This command is very simple to use, just remember two points: the file name and extension must be complete for the source file and no drive specification is given for the target. Renaming can only occur on a single disk drive (otherwise COPY must be used).
RMDIR (RD) Remove Directory Command
This command removes a directory. It is only possible to execute this command if the directory you wish to remove is empty.
C> rd mine
Removes directory called 'MINE'.
Stop Execution (Ctrl-Break)
If you wish to stop the computer in the midst of executing the current command, you may use the key sequence Ctrl-Break. Ctrl-Break does not always work with non-DOS commands. Some software packages block its action in certain situations, but it is worth trying before you re-boot.
Abbreviating filenames in DOS
DOS allows you to use a simple scheme of wild cards to refer to multiple filenames without having to type out the entire list of filenames that you want. There are two wild cards, the question mark and the asterisk. A question mark matches any character while an asterisk matches any string of characters. For example, `s?t' matches `sat', `sst', and `st'. Similarly, `s*t' would match each of the previous names as well as `short', `s123.45t'. The abbreviation `*.sav' would match any filename with the extension `.sav' (i.e., any SST system file), while `*' (or, equivalently, `*.*') would match any filename.
To obtain a listing of all the files on the A drive with the extension `.sav', type:
To copy all files from A to B, you could use the command:
C>copy a:*.* b:
SST uses a similar scheme of wild cards to abbreviate variable names.
Listing the contents of a file on the monitor
To display the contents of a text file on the monitor, you can use the DOS type command which has the following syntax:
As always, if the filename is not preceded by a drive specification, DOS assumes the file is on the default drive. To type a file on the A drive, use instead:
Not all files in DOS are textfiles. Files with the extension `.exe' or `.com' are executable programs stored in a binary format which cannot be typed.
To stop scrolling output on the screen
If you attempt to type a large file, it is apt to scroll down the screen faster than you are able to read it. To stop scrolling, press the and the keys simultaneously. To restart output, press the and keys again.
To print what is on the screen
If you have a printer connected to your computer and you would like a "hard" copy of what is currently on the screen, depress the and keys simultaneously, and DOS will send a copy of what is on the screen to your printer. If you want to obtain a printed copy of the rest of your computer session, depress the and keys simultaneously. Further output will be sent to the printer as it appears on the screen. To stop printing depress these keys again.
DOS allows you to organize disks into subdirectories--groupings of files in a tree structure. For most purposes a subdirectory on a disk is used as if it were a separate disk.
To create a subdirectory named sst, type:
The subdirectory sst now exists. There are two ways to access files in the subdirectory. First, you can make the subdirectory the default directory in the same way that you make a disk drive the default drive. This is done by changing directories:
You are now located within the sst subdirectory. To obtain a listing of files in the sst subdirectory, give the command:
Unless you specify otherwise, DOS assumes that you only want a listing of files in the default subdirectory--which is whatever subdirectory you happen to be located in at the time you issue a command. To return to the main (or root) directory, give the command:
The backslash (`\') is DOS's symbol for the top directory.
The other way to access files in a subdirectory is to provide DOS with a path telling it how to find the file you are interested in. If you are in the root directory and you would like to see the contents of a file in the sst subdirectory, try:
Thus, it is not necessary to change directories to access a file in another directory.
DOS allows you to create subdirectories in subdirectories so directory structures can become rather complicated. We do not recommend this practice if you are a newcomer to DOS. For the purposes of this manual we will assume that you do not have subdirectories to subdirectories.
Specifying pathnames can become rather tedious and DOS provides a facility for specifying which directories are to be searched for programs with the path command. If you type:
DOS will search the root directory (\) and the sst subdirectory (\sst) when it looks for programs to execute. With the above path command, it is possible to execute sst, for example, without being located in the sst subdirectory.
Here is some random commands you might wanna mess with.
Del Fc Md RAMDRIVE.SYS Sys
Append Deltree Fcbs Mem Rd Time
Attrib Device Fdisk Memmaker Rem Tree
Batch Commands Devicehigh Files MenuColor Ren Type
Break Dir Find MenuDefault Rename Undelete
Buffers Diskcomp For MenuItem Replace Unformat
Call Diskcopy Format Mkdir Restore Ver
Cd DISPLAY.SYS Goto Mode Rmdir Verify
Chdsk DOS Graphics More Scandisk Vol
CHKDSK Doskey Help Move Set Vsafe
CHKSTATE.SYS Dosshell HIMEM.SYS Msav Setver Xcopy
Choice DRIVER.SYS If MsBackup SETVER.EXE
Cls Drivparm Include Mscdex Share
Command Echo Install Msd Shell
CONFIG.SYS Edit Interlnk Mlsfunc Shift
Copy EGA.SYS INTERLNK.EXE Numlock SIZER.EXE
Country Emm386 Intersvr Path Smartdrv
Ctty EMM386.EXE Keyb Pause SMARTDRV.EXE
Date Erase Label Power Sort
Dblspace Exit Lastdrive POWER.EXE Stacks
DBLSPACE.SYS Expand Lh Print Submenu
Debug Fasthelp Loadfix Prompt Subst
Defrag Fastopen Loadhigh Qbasic Switches
Sorry about the poor structure of this, it's too early in the morning, well til' my next file :)