Sunday, July 4, 2010

MS-DOS Commands

MS-DOS Commands

MS-DOS commands are found in two varieties and locations. The internal MS-DOS commands are stored within the COMMAND.COM file and are always available. These provide key commands needed to access files and manage the operating system. The external MS-DOS commands are larger utilities stored as .COM or .EXE files in the MS-DOS directory. External MS-DOS commands must be on the current drive, some other drive whose location is stored in the PATH variable (that is, they can be in any directory as long the directory name and location is included in the path statement in the AUTOEXEC.BAT file), or be named with the complete path to the executable file to be run. The following table lists examples of commonly used internal MS-DOS commands.

Command Function
CHDIR or CD Changes the directory. (For example, cd\word would take you to the "word" subdirectory.)
CHKDSK Examines the FAT (file allocation table) and directory structure on a drive, checking for errors and inconsistencies that can keep you from accessing a file. It also locates lost clusters and can convert them into files for later deletion. It can also reclaim wasted space.
CLS Clears the screen.
COPY Copies files or disks. To copy all files from the "myfiles" subdirectory to the A (floppy) drive, the command would be: copy c:\myfiles\*.* a:
DATE Changes the system date.
DEL Deletes files. (Example: c:\del myfile.txt).
DIR Lists a directory of files.
DIR /P Views directories, one page at a time. (Directories can be quite long.)
DIR /W Displays wide format in columns-only the filename is listed; not size, date, or time.
DIR /W /P Displays large directories in columns, one page at a time.
DISKCOMP Compares two disks. The syntax is: a:\ diskcomp a: b: or diskcomp a: a: (the computer will prompt you to insert the second disk to be compared).
MKDIR or MD Makes a directory.
PROMPT Changes the appearance of the cursor.
REN Renames a file.
RMDIR or RD Deletes a directory. This works only if the directory is empty of all files including hidden ones.
TIME Changes the system time.
TYPE Displays (types) a text file.
VER Displays the version of MS-DOS in use.

The following table lists examples of commonly used external MS-DOS commands.

Command Function
DISKCOPY Makes a copy of a complete disk. Requires that both the source and the destination disk have the same format.
EDIT This command invokes the text editor program. This program is useful for making changes to text files such as editing CONFIG.SYS and AUTOEXEC.BAT.
FORMAT Prepares a disk for receiving files. Places a root directory on the disk.
FORMAT /S Formats a disk as a system disk.
UNDELETE Will (sometimes) recover a deleted file. Works only if the disk has not been modified since the file was deleted.
XCOPY Copies the contents of one disk to another disk. Does not require both disks to have the same format. (Note that it will not copy hidden files unless you use the /h switch.)

Getting Help in MS-DOS

The later versions of MS-DOS (4.0 and newer) provide some online help. There are two ways to access this information. You can type the word "help" followed by a space and the command, or type the command with the /? switch. In either case, you will get information regarding the proper syntax and available options for the command.



No comments:

Post a Comment