Preamble.
The following article is an introduction to DOS, the author is unknown, I obtained the basic text from a client who had the file on their computer and knew not of its origine. I have rewritten sections of the text, but the original author has done such a fine job that the work is very much as I found it. Enjoy. Chris J. Bartle.
Introduction to DOS Introduction
DOS is an operating system used on PCs (Personal Computers).
The Operating System is software, which controls the hardware of the machine (the disks, keyboard, mouse, monitor, etc.) and allows the user's programs and packages to be run on the machine. It is the interface between your word processor or spreadsheet or other program and the electrical signals which the CPU (the Central Processing Unit or Processor), the heart of the computer, understands.
Here is a summary of the development of Microsoft DOS (MS-DOS)
Version Year Features
1.0 1981 Original Disk Operating System
1.1 1982 Support for double-sided disks
2.0 1983 Support for sub directories
2.01 1983 Support for international symbols
2.25 1983 Bug fixes
3.0 1984 Extended character set, large hard disks
3.1 1984 Support for PC networks, bug fixes
3.2 1986 Support for 3.5-inch disks
3.3 1987 Support for PS/2 computers
4.0 1988 Support for large partitions
4.01 1989 Bug fixes
5.0 1990 New shell, new editor, smaller kernel, memory management
6.0 1993 Disk Compression, better Memory Management, and AntiVirus software now included in the operating software. had to be bought separately, as Utilities. 6.0 Contained a number of bugs.
6.2 1993 Microsoft claims it was not a bug fix for 6.0, but most observers saw it as that.Essential Components of DOS
DOS is composed of a number of files. You can choose to keep all of its components available on disk so that you can use all the facilities it offers (this is the norm if space is not a constraint).Alternatively you may choose to have a minimal setup in which case not all of its features will be available. However at a minimum there are three system files which you must have.
These are IO.SYS, MSDOS.SYS and COMMAND.COM.
The disk which your computer uses to load and run DOS must contain these files and is called the System, or Startup, or Boot, disk.
COMMAND.COM, the command processor (or shell) is the part of DOS that executes (or processes) the commands we will be looking at. These commands are either internal to the command processor (i.e. part of it), or external to it.
You must not create a file with the same name as an Internal Command. Examples of such commands are DIR, DEL and COPY, which are part of the COMMAND.COM program. You will find that the names of these commands cannot be seen when you list the files on your disk.
Each External Command is a separate executable program. When the user enters the name of an external command DOS reads the appropriate program file into memory and control of the computer system is passed to it; when the command terminates the command processor regains control of the system. External Commands e.g. XCOPY, can be seen when you list your files.
DOS has certain rules governing the naming of files -
Filenames are not case sensitive.
Maximum length allowed for a filename is 8 characters.
Maximum length allowed for the extension to a file name is 3 characters.
The file name and extension are separated by a . (period).
Characters not permitted in naming files are
. “ / \ [ ] : < > + = ; , ? ^ * And Spaces.These characters have special meaning when used in or with a file name.
File extensions can have special meaning to DOS or other programs and are often used to indicate the type of a file.
e.g. The .BAT extensions signifies a Batch files. A batch file contains a batch or group of DOS commands which are performed one after the other when the file is executed (or run). You execute a batch file by typing its name, without the .BAT extension, at the DOS prompt. AUTOEXEC.BAT is a batch file which is often found on the boot disk. DOS accesses this file in the last stage of booting (i.e. starting) your system and executes each command it contains.
Here are some commonly used extensions and the type of file they indicate :-
BAK Backup file.
BAS Basic program.
BAT Batch file; it contains a group of DOS commands the user wants to run.
COM Command file.
DOC Document.
EXE Executable file, Similar to COM file.
PRN Print file.
SYS System file.
$$$ Temporary file.Directory Names
These follow the same rules as ordinary file names except that extensions are not allowed in version 5 and earlier versions of MS-DOS. Remember that a directory is just a special kind of file - i.e. a file which can contain other files.When a list of files is displayed on screen the label <DIR>is appended to those names which in fact indicate directories.
Running DOS Commands
Commands are entered at the DOS prompt, e.g. A> or C> or F> which, as previously noted, informs you of the default or current drive. The exact form of the initial prompt depends on what type of disk booted the computer and whether the startup file AUTOEXEC.BAT, has customised the prompt. A letter plus > (greater than sign) is the default prompt.For example A> indicates that the computer was booted with a floppy disk, whereas C> means the computer was booted from a hard disk and F> indicates that the computer may have been booted from a networked machine.
A command line can contain just a command itself i.e. a single word, but most commands can take parameters (or arguments) indicating files or directories on which the command is to operate.
Parameters are separated from commands by one or more spaces.
You finish a command line by typing the Return or Enter key (<Enter> or <enter), and this signals the computer that you have finished typing in your command and that it should carry it out.
An example of an acceptable DOS command is CLS .
This is the clear the screen command. All existing text on the screen will be cleared and the prompt placed at the top left hand corner of the screen ready for the next command.
Changing the default disk drive.
Unless you specify in a command line a particular (Disk) Drive to use, DOS will attempt to execute the command on the current, or default, drive. i.e. It will look for the directories and files referenced in the command line on the disk in the drive indicated by the screen prompt, e.g.
A> (floppy disk)
C> (hard disk)Suppose the current/default drive is C and you are going to perform a lot of operations on your floppy disk in drive A. To avoid typing A: in your command line every time you execute a command you can change the default drive.
To change the default drive from C to A type A: <Enter>
The prompt will now include A instead of C
To make C the default drive again type C: <Enter>Repeating commands
Very usefully DOS buffers (i.e. remembers) the last command you typed in. If you want to run that command again simply press F3 and then <Enter> to run it. Alternatively you can press the F1 or key repeatedly until your command reappears, and then <Enter>.F3 Recalls the last command the user entered
F1 or Recalls the last command the user entered a character at a time Command Line Syntax command-name
DRIVE:\ PATH\DIRECTORY /SWITCHESFILE
This is a simplified illustration of the basic format of DOS command lines. The command-name is of course essential but, depending on what that command is, the other elements of the command line may or may not be present. Moreover some command lines will contain additional elements not included in this example. The components of the command line are explained below. (Note - it is not necessary to understand this abstract illustration of the DOS command line as examples are given for each of the commands discussed in these notes. Indeed you might prefer simply to look at the actual commands.)The components of the command line are - command-name = a DOS command DRIVE: = a letter plus colon indicating the relevant disk (drive) for the following path and directory/file.
UsuallyC: for the hard disk drive.
A: for the floppy disk drive.
B: if there is a second floppy disk drive.
F: for a network disk.PATH = a hierarchy of directories, each preceded by a \ (back slash), from the Root directory of the disk (represented by the first \) to the directory containing the directory or file on which the command is to be executed.
e.g. \faculty\dep_ment\admin
Note - If you are already in the directory which contains the file or directory to be manipulated then the drive and path do not need to be specified.
DIRECTORY = the directory on which the command is to be executed.
or FILE = the file on which the command is to be executed.
If a path has been specified then a \ must be placed before this item to separate it from the path.
e.g. \faculty\dep_ment\admin\minutes.doc
SWITCHES = ways of modifying the operation of the command.
Throughout the notes, a number of possible switches are listed for each command, however often no switches will be required.
Switches can usually be combined - i.e. you can have more than one switch for a particular command.
An example of how the commands are presented in the notes is now given using the DIR command.
The command name and a brief note of what it does is given in the heading, followed by a little more explanation, its syntax and some examples.
DIR - Lists files and subdirectories
This command lists information about files and subdirectories and the amount of free disk space.
Command Syntax: DIR DRIVE:\PATH\DIRECTORY /SWITCHES
FILE
Where SWITCHES are
P - page through the screens
W - produce a wide listing
Example: List the contents of the root directory of the hard disk
DIR C:\Error Messages
If what you type on the command line is not a valid DOS command, e.g. if you type in rubbish, or misspell a command, you will probably get the following response.Bad command or file name
Likewise if you type in the name of a command correctly but add too many parameters, or an invalid switch to it, DOS will respond with an appropriate error message.
DOS Help
Version 5 of DOS came with a command which helps the user establish what each DOS command can do. (DOS 6 provides a similar, more graphical facility.)Command Syntax: HELP command-name
Example 1: Display a brief description of what all the DOS commands do.
HELPExample 2: Display more information about a particular command e.g. DIR
HELP DIR
or DIR / ?
This will provide the syntax of the command in a form similar to that used in the notes.DOS COMMANDS, Disk Manipulation.
FORMAT - formats a disk
SYS - makes a disk a System disk
UNFORMAT - unformats a disk
DISKCOPY - makes a copy of a floppy disk
FORMAT - formats a diskA disk must be formatted for a particular operating system before it can be read from or written to by that operating system. DOS formatting creates a new root directory and file allocation table on the disk, it also destroys anything already on the disk. Therefore do not format a disk until you are sure there is nothing on the disk that you want to preserve.
You will not normally need to format a disk a second time (i.e. after your initial format of a blank disk). If you do reformat a disk, all existing data on it will be destroyed.
Command Syntax: FORMAT DRIVE /SWITCHES
Where SWITCHES are
S - create a DOS system/boot disk - i.e. Format the disk and automatically install the DOS system files (IO.SYS, MSDOS.SYS and COMMAND.COM) on it F:x - where x is the floppy disk size i.e. one of 160, 180, 320, 360, 720, 1.2, 1.44, 2.88The F switch is most commonly needed if formatting a DD (Double Density) disk in a HD (High Density) drive. Specifically, formatting a 3.5” 720 KB disk in a 3.5” 1.44 MB drive, e.g.
FORMAT A: /F:720
If you use the FORMAT command without switches on a 3.5” disk in a HD (1.44 MB) drive, DOS will attempt to format that disk to 1.44 MB even if it is a DD disk. This will result in a disk which is unreadable on DD drive machines. By using the F:720 switch the disk will be readable on both types of machine.
FORMAT A:
Example 2: Format a disk as a DOS System disk
FORMAT A: /S
Example 3: Format a 3.5” DD 720 KB disk in a 3.5” HD 1.44 MB drive
FORMAT A: /F:720
/T:80 /N:9SYS - makes a disk a System disk
If you already have a formatted disk which you want to be able to use as a System (or Boot) disk, you can install the 3 essential system files to it using this command.
Example: Make the floppy disk in drive A a system disk by installing the system files on the hard disk to it SYS C: A:
Note - that to make a disk a system disk you must either use the /S switch with the FORMAT command, or use the SYS command. Simply copying the system from one disk to another does not create a system disk.
UNFORMAT - unformats a disk.
The UNFORMAT command is a limited safe guard introduced in DOS 5 to recover data from a disk which have been lost as a result of performing a FORMAT.
You should not really need to use this command if you are careful. It is good practice always to use the DIR command on a disk to see if it has already been used before trying to format it. If DIR displays information about files and directories or disk space then the disk is already DOS formatted. (However this simple test does not let you know if the disk has already been formatted but for a Macintosh computer.)
Note - Unformatting a disk only works if the UNFORMAT command is used before putting any new files on it.
Command Syntax: UNFORMAT DRIVE: /SWITCH
Where SWITCH is TEST - display only, non committal of data. This shows how UNFORMAT would attempt to recreate the information on the disk, but does not actually unformat the disk and do so.
Example 1: Test to see how a disk would be recovered from a format
UNFORMAT A: /TESTExample 2: Actually recover from use of the FORMAT command
UNFORMAT A:DISKCOPY - makes a copy of a floppy disk
DISKCOPY makes an exact copy of one floppy disk (the source disk) on another (the destination or target disk). The original contents of the destination disk are destroyed. If the destination disk is unformatted DISKCOPY will format it. The disks should be of the same type (e.g. two 1.44 MB HD disks), however if the destination disk is of a different type from the source disk DISKCOPY will try to format it to match the source floppy disk but this may not be possible.
Note - The XCOPY command (see later) is the best command to use when copying files between different types of disk (e.g. a 720 KB DD disk and a 1.44 MB HD disk), or when you want to preserves the original contents of the destination disk.
Command Syntax: DISKCOPY DRIVE1: DRIVE2:
(source disk) (destination disk)
Example 1: Make a copy of a floppy disk using two identical drives. (The copy will be from the floppy disk in drive A to the floppy disk in drive B)DISKCOPY A: B:
If you only have one floppy disk drive, which is normal, you can still make an exact copy of a floppy disk. You specify drive A twice in the command line, start the copy with the source floppy disk in that drive, and swap it with the target floppy disk as directed during the copying operation until the copy is complete.
Example 2: Make a copy of a floppy disk using one drive
DISKCOPY A: A:
Directory Manipulation
MD or MKDIR - creates a directory
CD or CHDIR - changes directory
PROMPT - changes the command prompt
TREE - displays the directory structure
RD or RMDIR - removes a directory
Renaming directories PATH - creates a search path
MD or MKDIR - creates a directory
The MD or MKDIR command is used to create subdirectories in the root directory or other subdirectories.
Command Syntax: MD DRIVE:\PATH\DIRECTORY
Example 1: Create a subdirectory named DOCS in the root directory of C
MD C:\DOCSExample 2: Create a subdirectory of the DOCS subdirectory called WORK
MD C:\DOCS\WORK
Example 3: Create a subdirectory of WORK called TEMP
MD C:\DOCS\WORK\TEMP
Example 4: If you were already in the WORK directory (see next section re changing directory) the following would be sufficient to create the TEMP subdirectory
MD TEMP
CD or CHDIR - changes directory
The CD or CHDIR command is used to move from one directory to another; or to show the current directory path (i.e. the hierarchy of directories from the root directory to the one you are currently working in). The directory you are currently in is known as the current or default directory. When you move to another directory it becomes the current directory. Once your system has booted your initial current directory will normally be the root.
Command Syntax: CD DRIVE:\PATH or CD DOS uses the following 'special' characters to reference particular directories within the directory structure and these can also be used with the CD command.\ - the Root Directory
. - the Current Directory
.. - the Parent Directory of the current directoryExample 1: Move to the subdirectory TEMP (assuming it exists)
CD C:\DOCS\WORK\TEMP
Example 2: Display the path to the current directory (i.e. Current Directory Path)
CD
Example 3: Move to the parent directory of the current directory
CD ..
Example 4: Move back to the subdirectory TEMP (this example assumes you are currently in subdirectory WORK; use example 2 to check before moving)
CD TEMP
Example 5: Move to the root directory. (This will make the root the current directory)
CD \
PROMPT - changes the command prompt
It is useful if you can see immediately from the command/screen prompt what directory you are currently working in (i.e. the current directory) and the path to that directory. The PROMPT command enables you to do this.
To make the command prompt show the path to the current directory, and not just the letter representing the default disk drive, type
PROMPT $P$G
Your AUTOEXEC.BAT file may already include this command line, if not it can be edited to do so.
In this way a useful prompt will be set up every time you start a new session on your computer.
After typing PROMPT $P$G as indicated, move up and down through the directory structure to see how the prompt changes.
TREE - displays the directory structure.
The TREE command enables the user to obtain a graphical view of the structure of directories and subdirectories on a disk.
Command Syntax: TREE DRIVE:\PATH /SWITCH
Where SWITCH is F - Display the names of files in each directory
Example 1: Display the structure of the DOCS directory
TREE C:\DOCS
Example 2: Display the directory structure and files of C
TREE C: /F
RD or RMDIR - removes a directory
RMDIR or RD is used to remove a directory. This command will only work if the directory concerned is empty.
Command Syntax: RD DRIVE:\PATH\DIRECTORY
Example: Remove the empty subdirectory of C:\DOCS\WORK called TEMP
RD C:\DOCS\WORK\TEMP
DOS 6 introduced the DELTREE command which allows you to delete directories whether or not they are empty. (i.e. it allows you to delete all the files and subdirectories in a directory plus the directory itself with a single command.) This command should be used with care.Renaming directories
In DOS 5 there is no single command that allows you to rename a directory. You have to use a combination of the MD, XCOPY, DEL and RD commands. This has been addressed in DOS 6 with the introduction of the MOVE command which can be used to rename directories or move files. (For DOS 5 renaming directories is simpler with DOSSHELL - see later.) PATH - creates a search path.For many DOS commands (viz. external commands) there is a program file which has to be executed in order for the command to work. In the examples so far we have assumed that this is not a problem but in fact DOS has to know where on disk, i.e. in which directory, the corresponding program file is. If it cannot find the file then the command will fail.
By default DOS will only look in the current directory for this program/executable file. If it is not there then DOS has to be know the path (i.e. the hierarchy of directories from the root) to it.
This can be achieved by pre-pending the relevant path to the command name whenever composing a command line. However it would be better if DOS could simply be told in which directories to look for program files whenever a command name was entered. This can be achieved by using the PATH command. It enables you to specify the path to directories DOS should search, after the current directory for the program file for a command. Once this command has been issued DOS will remember these directories until the command is used again either to clear the search path or set a new search path, or until the machine is switched off.
Command Syntax: PATH DRIVE:\PATH
You can have multiple occurrences of DRIVE:\PATH each separated by ;
Example 1: Set a path to \ (the root directory), and the DOS directory
PATH C:\;C:\DOS
This instructs DOS that after it has searched the current directory for a program file, it should then search the root directory of C: and then the DOS subdirectory of the root.This should be a minimum search path when using DOS because most of the DOS program files are usually kept in the DOS subdirectory and the root directory. It allows the DOS commands to be used, as in these notes, without pre-pending them with a path.
A search path containing at least these elements is usually set up in the AUTOEXEC.BAT.
Example 2: Add the directory MEMOS on the floppy disk to the search path
PATH C:\;C:\DOS;A:\MEMOS
You can also use the PATH command to see what directories are currently in the search path, and to clear it.
Example 3: Display the current search path
PATH
Example 4: Clear the search path
PATH ;
File Manipulation
DIR - Lists files and subdirectoriesWildcard Characters ? *
EDIT - creates a new file or modifies an existing file COPY - copies a file or a group of files XCOPY - copies all files in a directory (and its subdirectories)DEL or ERASE - deletes a file or a group of files
UNDELETE - undeletes files
COPY (or XCOPY) plus DEL - moves files
DOSKEY - recalls commands
RENAME or REN - renames files
TYPE - displays text files
PRINT - prints a text file
COPY - used to create a file
ATTRIB - sets file properties
FC - compares two files
DIR - Lists files and subdirectoriesThis command lists the names of files and directories in the current directory, or one specified in the command line. It can also provide additional information such as the amount of free space on the disk, the dates directories were created, and the dates files were last modified and there sizes.
It is also possible use DIR to search for specific files.
Command Syntax: DIR DRIVE:\PATH\DIRECTORY /SWITCHES
FILE
Where SWITCHES are
P - page through the listing one screen at a time
W - produce a wide listing
S - execute the command in subdirectories of the
subject directory as well as the directory itself
A:x - list only files with attribute x where x = h (hidden), r (read only), s (system)
O:y - order the listing according to y where y = n (name), e (extension), s (size), d (date and time - earliest first)
B - blank out heading and summary information
Example 1: List the contents of the root directory of the floppy disk
DIR A:\
Example 2: Produce a wide listing of the current directory of C one page at a time
DIR C: /P /W
Example 3: List every occurrence of the file AUTOEXEC.BAT in the current directory and its subdirectories
DIR AUTOEXEC.BAT /S
Example 4: List the contents of the DOS directory in chronological order
DIR C:\DOS /O:D
Example 5: List only those files in the root of C which are hidden
DIR C:\ /A:H
Wildcard Characters ? *A Wildcard Character is a character which has special meaning. In DOS wildcards are the * (the asterisk) and ? (the question mark ). They are usable with many DOS commands. The question mark represents any single character, and the asterisk a string of characters. Wildcards enable you to do more with the basic commands.
As examples, suppose you wanted to use the DIR command to list only the files that ended with a particular extension, or started with a particular word.
Example 1: Display only those files in the root of C whose name ends with the .COM extension
DIR C:\ *.COM
Example 2: Display those files in the DOS directory which start with DISK, are followed by 4 characters, and have any extension.
DIR C:\DOS\DISK????.*You should get into the habit of using the DIR after you have executed a command (e.g. the MD or CD commands discussed above, or the COPY, DEL etc. commands below) to confirm the effects of that command.
EDIT - creates a new file or modifies an existing file
To create a text file in DOS you invoke the Screen Editorby using the EDIT command.
Command Syntax: EDIT DRIVE:\PATH\ FILE
FILE must be an unformatted ASCII text file
Carry out the following steps to create your own file; this will give you a file on which to practice the other commands.
Type EDIT <Enter> at the DOS prompt.
Once in the editor press the ESC key.
You should get the following screenThen type in the bold text below, using your own name where it says your name. This text will constitute the contents of the file.
(If you make a mistake while typing use the following keys to make corrections. - The Delete and BackSpace keys to remove letters; the (Arrow) keys to position the Cursor without removing letters; and the Insert key to switch between Insert and Over Write mode.)
@echo off
echo.
echo GOOD DAY your name
echo.Once you have finished press the Alt key which, as indicated at the bottom of the screen, activates the menus.
You will see the first letters of the Menu Items at the top of the screen become illuminated. The File item should be highlighted. If not use and to highlight it. Press the Return or Enter key to activate the File Menu. Use to move the menu Bar down to Save As, and press <Enter> to select this option.
Type in the file name HELLO.BAT <Enter>. You have now created a file called HELLO.BAT, containing the above text. Now leave the Editor by activating the File Menu, and then selecting Exit.
The file you have just created is a simple Batch file - i.e. a file of DOS commands which willl be executed, one after the other, simply by typing in the name of the file (with out the .BAT extension).
To run this batch file type HELLO <Enter> at the DOS prompt.
The message Good Day should appear.
The Editor provides an easy method of creating a new text file. It is particularly useful for creating DOS batch files (which are special text files). If you want to modify/edit an existing text file then you simply supply the name of that file as a parameter to the command. Once in EDIT you can use a mouse, or simply the keyboard, to highlight text, cut (or copy) and paste that text, select menu items, etc. Most of the commands in EDIT are self explanatory and easy to use.
Example: Edit the batch file you have just created.EDIT HELLO.BAT
COPY - copies a file or a group of files
The COPY command enables you to make copies of files. It may be used to make a copy within a particular directory, to copy from one directory to another and to copy from one disk to another.
You can use the command to copy one file by using its filename, or several files by using the DOS wildcard characters * and/or ?
Command Syntax: COPY DRIVE1:\PATH1\ FILE1(S) DRIVE2:\PATH2\ FILE2(S)
Example 1: Copy one file from drive C to drive A
COPY C:\HELLO.BAT A:Example 2: Make a copy of a file within the same directory. You have to give the copy a different name. e.g. GREETING.BAT
COPY A:\HELLO.BAT A:\GREETING.BAT
Example 3: Copy all the files in the root of A to a directory on the hard drive
COPY A:\*.* C:\DOCS
Now use the DIR command to list the files on drive A again.
XCOPY - copies all files in a directory (and its subdirectories)
The XCOPY command behaves in the same way as the COPY command, however it allows the copying of all the files in a directory, and also its subdirectories.Command Syntax:
XCOPY DRIVE1:\PATH1\DIRECTORY DRIVE2:\PATH2 /SWITCHES
FILES
Where SWITCHES are
S - copy subdirectories which contain files
E - also copy empty subdirectories (/E is used with /S)
D:date - only copy files changed after a certain date
Example 1: Copy the contents of the DOCS directory, and its subdirectories, including empty ones,
to directory TEMP-DIR on A
XCOPY C:\DOCS A:\TEMP-DIR /S /E
DOS will allow you to create the TEMP-DIR if it does not already exist.
Example 2: Copy all the files in the root directory of C modified on or after 1/1/96 to A
XCOPY C:\*.* A: /D:1/1/96
Example 3: Copy all the files in the A drive's TEMP-DIR directory to a directory with the same name on the C drive
XCOPY A:\TEMP-DIR C:\TEMP-DIR
DEL or ERASE - deletes a file or a group of files.
The DEL or ERASE commands perform the same operation; you can use either.
Command Syntax: DEL DRIVE:\PATH\FILE(S) /P
The P switch causes DOS to prompt the user with the name of the file to be deleted, to confirm that this is really his intention, before actually carrying out the deletion. If the P switch is omitted then the deletion is carried out silently.
Example 1: Prompt the user with the name of each file in the current directory that has the extension
.BAK, and ask him to confirm whether it should be deleted
DEL *.BAK /P
Example 2: Delete the file HELLO.BAT from the DOCS directory
DEL C:\DOCS\HELLO.BAT
Example 3: Delete all files in the root of A
DEL A:\*.*
Whenever the wildcard character is used in this manner, the user is always reminded that all files in the directory will be deleted, and asked to confirm Yes or No.Warning
NEVER delete the file COMMAND.COM file since it is the file which enables DOS commands to run.
Be very careful when using wildcard characters with the DEL/ERASE command, as you will not be asked to confirm the deletion of individual files when using it (unless you use the /P switch) and so may delete a file which you really need to keep. You should always use DIR to list the contents of the directory before you start deleting using wildcards, to see exactly what files will be affected.UNDELETE - undeletes files
The UNDELETE command, which was not available before DOS 5, attempts to undo the use of DEL. It provides a degree of protection against accidental deletion of files. UNDELETE relies on the fact that DELeting a file does not physically remove it but simply marks the area of disk concerned as available for reuse. Thus once you have deleted a file you will not see it if, for example, you execute the DIR command but providing it has not been subsequently overwritten it should be recoverable using UNDELETE.
Command Syntax: UNDELETE DRIVE:\PATH\FILE(S) /SWITCHES
Where SWITCHES are
LIST - list all files deleted which have not been subsequently overwritten ALL - undelete all deleted files without prompting the user Example 1: Undelete the file called HELLO.BAT which has been deleted from the A drive
UNDELETE A:\HELLO.BAT
If recoverable the dialogue will be continue something like this -
Directory: A:\
File Specifications: HELLO.BATDeletion-tracking file not found.
MS-DOS directory contains 1 deleted files.
Of those, 1 files may be recovered.
Using the MS-DOS directory method.
?ELLO BAT 49 1/1/96 16:23 ...A Undelete (Y/N)? Y
Please type the first character for ?ELLO .BAT: H
File successfully undeleted.
Example 2: Undelete all files that are recoverable in the current directory
UNDELETE
COPY (or XCOPY) plus DEL - moves files
DOS 5 does not have a specific command for moving files (DOS 6 does) but this can be achieved by using the COPY (or XCOPY) and DEL commands. i.e. Making copies and then deleting the originals.
Example: Move all the document files in the root directory of drive C to drive A
COPY C:\*.DOC A:
DEL C:\*.DOC
RENAME or REN - renames files
The RENAME or REN command is used to rename a file or a group of files. The file contents and
the location of the renamed files remains the same.
Command Syntax: REN DRIVE:\PATH\ FILE1 FILE2
Example 1: Rename a single file
REN C:\HELLO.BAT MESSAGE.BAT
Example 2: Rename a group of files to have a common file extension
REN A:\TEMP-DIR\*.BAT *.BAK
DOSKEY - recalls commands
The DOSKEY command is only available in DOS 5 and 6. Once the command is issued and the DOSKEY program installed it saves subsequent command lines typed in at the keyboard in an area, or buffer, of RAM; this in effect means that it 'remembers' previous command lines. The user can
recall these lines with a few simple keysrokes instead of having to type them in again.
To start DOSKEY type
DOSKEY <Enter>
From this point on the command lines you input will be remembered.
You can then use the and (or F8 ) keys to view the command lines and <Enter> to execute your choice.
You can edit a command line you have recalled by using the and keys to position yourself within the line and using the Insert key to switch between OverWriting and Inserting text before typing in your changes. You can also clear the current command line by pressing the ESC key.Additionally
F7 Displays a numbered list of the commands DOSKEY has stored
F9 Allows you to selects a command by number
Alt+F7 Clears the buffer
TYPE - displays text files
The TYPE command is used to display the content of a textfile on screen. (If the screen displays garbled characters, with regular beeping sounds, then it is likely that the file is a non text file.) TYPE merely displays a file; it does not allow you to edit/change it.
Command Syntax: TYPE DRIVE:\PATH\ FILE
Example: Display the contents of a file called MESSAGE.BAT
TYPE MESSAGE.BAT
PRINT - prints a text file
The PRINT command allows you to obtain a print-out of a text file. Printers are slow devices and are often shared by more than one computer. Obviously you do not want to have to wait until your file is physically printed before being able to continue using your machine. Therefore when you execute the PRINT command your file is added to a print queue - this is a list, stored in memory, of files waiting to be printed. This 'queuing' of a file by PRINT is very quick; much quicker than the actual printing of the file. Once the PRINT command has been executed DOS is free to execute other commands even though the relevant file might not yet have been printed. You can continue working and the file will be printed, in the background, when it reaches the top of the queue.And that is the end of this basic tutorial covering the use of DOS.
I trust that this tutorial has wetted your appetite for more information about DOS and the operating system that your computer runs on. If you are interested in learning more there are many classes available that specialise in various aspects of computer operation, as you seek out educational opportunities don't disregard Night Classes and Correspondence Courses. In Australia Correspondence Courses are very affordable and you can study at your own pace.As I say continually : COMPUTERS ARE SUPPOSE TO BE FUN !
FIDDLE !!!! And LEARN !!!!