DOS COMMANDS FOR BEGINNERS


Most people will not need to know or use these commands at all, but they are well worth knowing understanding and practising. Most the command will also work through and within windows many 95/98 programs.

DOS stands for disk operating system. DOS is the software program, which controls the input and output of your computer.

Over the years DOS has been produced in a variety of versions. New commands and capabilities have been added and different versions for a variety of machines have evolved. Presently at the time of updating this (1997) we are up to Dos a version of Dos 7 which is provided as part of and inside Windows 95/98 system.

Never erase the following files, if you do the computer will most likely not start these are called:

MSDOS.SYS

IO.SYS

COMMAND.COM

These are the heart of your computer and it will not run properly, if at all, without them. Never erase the DOS directory as this is where the operating system is. The computer will not run properly without Dos.

In the case of Windows 95/98 then the operating system dos files are found in the actual windows and windows\command directories. You should not erase these directories unless you know what you are doing.

GETTING THE FEEL - POWER ON

There are TWO ways to use DOS.

1.) Directly at the prompt using what is termed a COMMAND LINE. This is the detailed method we will look at in a paragraph or so.

2.) A second way is to use a DOS SHELL or MENU to manage files and other data.

If a:\> is on the screen at power up or if you are asked to insert a system disk, then it's possible that you might not have a hard disk. Or that your hard disk might not yet have an operating system written onto it.

If there is a hard drive, but no operating system, then simply insert the first Dos or operating system disk into the floppy drive or any supplied boot disk and then turn on the computer, it should go into the set-up procedure. Follow the on screen instructions, it will or should, tell you what to do.

A Dos Prompt is the

C:\>

that you should see on your screen. However shutting down to dos from windows 95/98 would show

C:\>WINDOWS

The following examples are best practised at the DOS prompt

A:\>

or

C:\>

You might wish to print this file and then practice the examples with your computer.

Now let's begin the basic commands tutorial:

You can CHANGE the default drive simply. Put in a formatted floppy disk. Then let's try switching drives. Type one of the following three lines then hit enter

a:

b:

c:

type in either Capitals or lower case it makes no difference, as either will work.

First practice getting this symbol below (two dots one above the other usually found located next to the letter L key)

:

on your screen, you will use it quite a lot. Use one of the shift keys and the key next to the letter L to get this : on screen.

You MUST get into the habit of pressing ENTER or RETURN after you type in any command. If you do not press ENTER or RETURN the command will not work. The RETURN and ENTER keys do the same thing. ENTER is the last bottom key to your right of the keyboard. RETURN is the large key located above the shift key to your right of the keyboard.

What you are doing is switching between your drives, go back and forth a few times. Switching drives is very important since dos pays attention to the drive of which letter is displayed! Next let's try some other simple DOS commands.

try typing VER then press enter key

try typing DIR then press enter key

try typing MEM then press enter key

In the above examples, you first asked DOS to tell you what version of DOS you are using. Next you requested to be shown the Directory contents. Then you requested to see your memory configuration.

Now try these . . .

dir/w press enter /w - means "wide across the screen" dir means show directory contents

dir/p press enter - show directory and Pause the screen a page at a time

dir/w/p press enter - wide and pause directory display

dir/o press enter - give directory with files listed in alphabetical order.

dir a: press enter - list a: drive contents with a floppy in the drive of course.

dir b: press enter - list b: drive contents

dir/w/o/p press enter - all the above commands together (directory, wide, order, paused)

help press enter - show dos help files

help /? press enter - shows windows dos help file commands

For Dos 6.0 & 6.2 users you can work your way about a help menu by using the CURSOR (Arrow) Keys. Move the flashing blinker to the command you want to read about and simply press ENTER. To escape or quit help, press ALT then ENTER next move the highlight bar at the top left of the screen, to where it says exit and then press ENTER.

SUB DIRECTORIES

Floppy disks have a relatively limited space to store files they are limited in comparison to the space on a hard drive. To find a necessary file name on a floppy, just use the DIR or directory command. However, on a hard disk things get a little out of hand with hundreds of files all listed on the same screen.

Dos solution to this is obtained by adding sub directories and path names to manage the location and organization of files.

A path is nothing more than a "trail" or "direction post" which helps DOS find a particular file out of the hundreds which may be located on a hard drive.

This path name is facilitated by the use of multiple directories (called sub directories) on a single disk. In this fashion you sort files into groups in a specific place on the drive. By the way, a sub directory is itself a small file and does occupy space on the disk.

You could compare a hard or floppy disk to a shop. The shop might sell toys, books and clothes. Similar items go in the rightly allocated area of the shop.

A disk also has the capacity for many separate areas in which to place files. DOS refers to these with a main central directory (root directory) and sub directories branching below it. You can create a sub directory named TEXT which contains all your word processing documents. Computer utilities could be in a sub directory called UTIL, and so on.

On the screen, a listing of any sub directory might show the first two entries mysteriously named

. ..

(single dot and double dot).

The first dot is a name for the sub directory itself. The double dot is a name for the parent (higher) directory one level up.

MAKE DIRECTORY

MD MAKES A DIRECTORY. e.g. MD GAMES

CD\ brings you to the root (main directory) no matter where you are.

cd\dos (change to the dos directory)

cd\windows\system (change to sub directory within a directory) windows system.

If you were already in a directory and need to change to a sub directory within, then you would not use the \ slash you would instead use just the space key.

EXAMPLE if you were in windows directory you would have this on your screen

c:\>windows>

To now change to the command sub directory you would type the CD command

CD.. To get back to the main directory

CD\ ALSO gets back to A route directory

CD CHANGES DIRECTORY e.g. CD GAME or CD\GAME

dir SHOWS A DIRECTORY CONTENTS

dir/w DIRECTORY WIDE ACROSS THE SCREEN

dir/p DIRECTORY PAUSE A PAGE AT A TIME

dir/w/p WIDE AND PAUSE DIRECTORY

dir/o DIRECTORY ORDER ALPHABETIC

dir *.exe DIRECTORY OF FILES ENDING .EXE

dir *.bat DIRECTORY OF FILES ENDING .BAT

dir *.COM DIRECTORY OF FILES ENDING .COM

dir t*.* DIRECTORY OF FILES BEGINNING WITH THE LETTER T

dir ta*.* DIRECTORY OF FILES STARTING TA

dir /s DIRECTORY SHOW TRUE FULL SIZE AND SUB DIRS

dir /s *.txt USE THIS FROM C:\PROMPT AND EVERY FILE ON YOUR HARD DRIVE ENDING TXT WILL BE DISPLAYED.

FILE NAMES & EXTENSIONS

When you see the following

*.*

This means select or show all files (example: copy move delete *.*)

When you see the following

*.

This is typed by pressing the shift key and the number 8 key at the top row (above I an U) of the keyboard and the full stop. It means select or show only any file ending For example *.bat means file ending .bat

When looking at an individual file, look at the extension, the bit after the dot. This will give you a clue what sort of file it is.

For example

Autoexec.bat is a bat file bat short for batch.

Config.sys is a sys file short for system file

DELTREE RD or RMDIR

RD removes an empty sub directory (it cannot remove a sub directory loaded with files as a safety measure use the DEL *.* command to first clear a sub directory.)

The root (main) directory cannot be removed. But the files could be deleted. Should you do this you will lose your systems main operating files The computer would not work.

Deltree removes a directory sub directories and all files within them. Example: deltree Temp Available with Dos 6.0 and above

Del *.* removes files but not directory or sub directories.

If you try to deltree a directory from the dos prompt and it does not complete the job, then the problem is more likely to be that you have one or more hidden files in there. You would now need to change their attributes to then delete them.

You cannot see a hidden file from the dos prompt. You would need to use windows file manager or a dosshell type program, such as Norton commander or Xtree gold. However, you would still first have to tell such a program to enable or display the hidden files on screen. The default is do not show them as they are usually of importance to a program or your operating system.

FILE ATTRIBUTES

You need to learn about attrib - short for file attributes, this is four different styles of file types. Archive. System. Hidden. Read Only. A files attributes can be changed. You can not write to a read only file unless you first change the attributes of that file to archive. You can not see o hidden file from the dos prompt. It's best to leave this till you become more experienced but you can see Dos Help for further details if you really need to.

Dos commands

del c:\games - WOULD DELETE ANY FILES IN THE DIRECTORY BUT NOT THE DIRECTORY NOR ANY SUB DIRECTORIES

copy *.* - COPIES FILES FROM ONE PLACE TO ANOTHER e.g. copy a:*.* c:\games

copy *.* b:/v - COPY AND VERIFY A GOOD COPY.

diskcopy a: a: - COPY THE CONTENTS OF ONE DISK TO ANOTHER

move *.* - MOVES FILES FROM ONE PLACE TO ANOTHER AVAILABLE ON DOS 6.0 6.2 UPOVER

xcopy - COPIES FILES AND DIRECTORIES FROM ONE PLACE TO ANOTHER

label - WOULD ALLOW A DISK TO BE NAMED.

Chkdsk - CHECKS A DISK

Scandisk - CHECK A DISK (ONLY IF RUNNING DOS 6 OR 6.2 OR UPOVER)

Mem - SHOWS YOUR MEMORY USAGE CONSUMPTION and WHAT IS FREE ETC

mem/c |more - SHOWS AN ADVANCED DISPLAY OF MEMORY USAGE

memmaker - AUTOMATIC MEMORY CONFIGURATION FROM DOS 6.0 AND 6.2 UPOVER

dblspace - COMPRESSES DATA DOUBLING HARD DRIVE SPACE ONLY DOS 6.0 6.2 UPOVER

cls - CLEARS THE SCREEN

date - SHOWS AND ALLOWS THE DATE TO BE CHANGED

time - SHOWS AND ALLOWS THE TIME TO BE CHANGED

ren old.txt new.txt - RENAMES THE FILE OLD.TXT TO NEW.TXT

vol - SHOW THE VOLUME LABEL OF A DISK

comp - COMPARES TWO FILES

diskcomp a: b: - COMPARES TWO DISKS

undelete - IF YOU MAKE A MISTAKE AND ERASE A FILE YOU WILL BE ASKED TO INSERT THE FIRST LETTER OF THE

NAME OF THAT FILE TO RECOVER IT.

The often used *.* means ANY FILE NAME and ANY extension regardless of length. But does not include Sub directories.

The often used *. Means any file name ending with the extension e.g. dir*.bat

USING DOS FORMAT

format - WOULD NOT FORMAT A DISK

format a: - TO FORMAT DRIVE A:

format b: - TO FORMAT DRIVE B:

format c: - TO FORMAT A HARD DRIVE

format a: /u - FORMATS WITHOUT SAVING A MIRROR IMAGE OF WHAT WAS PREVIOUSLY ON A DISK THIS

LEAVES THE TOTAL DISK SPACE COMPLETELY EMPTY.

format a: /q - SUPPLIES A QUICK FORMAT

format a: /u /q - AS ABOVE TWO COMMANDS TOGETHER

format a: /f:720k FORMATS A DOUBLE DENSITY 720K DISK

format b: /f:360k -FORMATS A DOUBLE DENSITY 360K DISK (5.25 size)

format a: /s - MAKES A BOOTABLE SYSTEM DISK

UNDELETE

If you should accidentally erase a file that you need, then try typing UNDELETE from the dos prompt. This would retrieve it, but you will be asked to type in the first letter of the file name, to be able to continue and retrieve it. Example: !utoexec

If you have erased files and since this, placed something else onto the hard drive, the new files usually over write the space previously used, in this case you may not be able to retrieve lost files.

USING CHKDSK OR SCANDISK

chkdsk b: - check b: floppy, all files

chkdsk c:\*.* - check for contiguity of files in root of c: drive Scandisk is more advanced than chkdsk and available with Dos 6.2 up over

scandisk c:\ - scans and checks c:\

scandisk a:\ - scans and checks a:\

USEFUL KEYS

In most applications you will use these are the most often used keys.

F1 THROUGH TO F12 (F1 Usually brings a help file)

ALT

TAB (Key with two arrows on it to the left of the keyboard)

ESC

ENTER RETURN (both the same function)

F10 In most applications will access a menu (DOSSHELL WINDOWS)

CTRL ALT DEL (Reboot system) Touch the three keys in succession.

CURSOR KEYS (arrow keys)

: a colon