MS DOS NOTE



DOS (DISK OPERATING SYTEM)

A disk operating system (abbreviated DOS) is a computer operating system that can use a disk storage device, such as a floppy disk, hard disk drive, 




 Internal Commands
Previous   |    Content   |   Next
These commands are automatic loaded into the memory when operating system is loaded into the memory. Thus these are also called memory-resident commands. The command available are all combined together and are stored in Command.com file, which is a executable command file. These internal command are further grouped according to their properties. These are as follows.
Genral purpose
File related commands
Directory related commands
1. CLS
2. 
DIR
3. 
VER
4. 
VOL
5. 
DATE
6. 
TIME
7. COPY CON
8. 
TYPE
9. 
COPY
10. 
REN
11. 
DEL
12. MD
13. 
CD
14. 
RD

General purpose commands
1. CLS:- (Clear the screen) This command is used to clear the screen or wipe out every thing written on the screen.
Syntax:-    C:\> CLS   and press Enter
2. DIR:- (Directory) Dir command is used for listing files and directories present in the current disk.
Syntax:-  C:\> DIR [/switches]
Example:-   C:\> DIR /P
 
Switches:-
/P
 Page wise
/W
 Widths wise
/S
 List all files and directory of subdirectories
/AH
 Display directory with hidden files
/AS
 Display directory with system files
/AD
 Display only directories present in current drive
3. VER:-(Version) Version numbers indicates that which edition of DOS we are working on.
Syntax:-  C:\> VER   press enter
Output:-
C:\>VER

Windows 98 [Version 4.10.2222]
4. VOL:-(Volume) Displays the disk volume label and serial number, if it exist.
Syntax:- C:\> VOL  press enter
Output:-
C:\>VOL

Volume in drive C is JAI
Volume Serial Number is 3E42-1907
5. DATE:- Display the current Date
Syntax:-  C:\> DATE
C:\>DATE
Current date is Fri 02-15-2002
Enter new date (mm-dd-yy):


Type DATE without parameters to display the current date setting and
a prompt for a new one. Press ENTER to keep the same date.
Note:- We enter new date in the format of MM-DD-YY.
6. TIME:- Display current time
Syntax:- C:\> TIME( am= ante meridian) (pm= post meridian)
C:\>TIME
Current time is 8:38:47.70a
Enter new time:


Type TIME with no parameters to display the current time setting and a prompt for a new one. Press ENTER to keep the same time.
Note:- We enter the time in the format of 24 hour clock.

File related commands
7. COPY CON:- This command gives the facility to create a new text file.
Syntax:-  C:\> COPY CON <Filename>
C:\>COPY CON Rose.txt
A clock in a office can never get stolen
Too many employees watch it all the time
^Z
1 file(s) copied


After copy con we must specify a suitable file name. Press enter. Start typing the informations of the file. After gathering the information we press ^Z (CTRL+Z) button or F6 button to save the file. After pressing enter key computer will show a message like 1 file(s) copied. This means that file is stored in the disk. Suppose we don't want to save the file or we just want to abort from file creation job, then we simply press ^C (CTRL+C) button to abort without saving the file, intend of pressing ^Z button.
Notes:-  1. Never forget to give a suitable filename
              2. You can use extension as .TXT for denoting the file as Text file.
8. TYPE:- This command is used to display the contents or text of any file to the display device.
Syntax:- C:\> TYPE <Filename>
A:\>TYPE GULAB.TXT
A clock in a office can never get stolen
Too many employees watch it all the time
9. COPY :-  Copy command is used for copy any file to another location or to copy the files to another directory. This command may also be used for copying any file to another disk with different file name.
Syntax:-  C:\> COPY <Source filename> <Target file name>
 
C:\>COPY ROSE.TXT ROSE.MSG
         1 file(s) copied
TO copy a file from hard disk to floppy disk
C:\>COPY Rose.txt A:
      1 file(s) copied
To copy a file from Floppy Disk to Hard disk
A:\>COPY LOTUS.TXT C:\
1 file(s) copied
10. REN:- (Rename) This command is used to change the name of any file or directory.
Syntax:- C:\> REN <Source filename> <Target filename>
C:\>REN ROSE.TXT GULBAL.TXT
If we get successfully C:\ that means filename or directory name is get changed. Either it will show the error message.
To changing the filename present in floppy disk
C:\>REN A:\ROSE.TXT GULAB.TXT
Note that you cannot specify a new drive or path for your destination.
11. DEL:- This command is used for erasing any file from the disk.
Syntax:- C:\> DEL <Filename>
C:\>DEL LOTUS.TXT
If it successfully erase the file from dosk then C:\> prompt will be appear, either computer will show an error message.
Note:- /P option is used for permission before deleting the file.

Directory related commands
12. MD:- (Make Directory)- This command allows to create a new directory. 
Syntax:- C:\> MD <Dirname>
C:\> MD REPORT
C:\>
Now this directory can be used for keeping various sort of reports. Under this directory we can create another directory which is known as subdirectory.
13. CD:- (Change Directory):- We can enter or exit from any directory using this command.
Syntax:- To access any directory
C:\> CD <Directory name>
C:\> CD REPORT
C:\REPORT>
Prompt will change with the directory name. If we keep two dots after CD command than we will exit from the directory.
Syntax:-C:\> CD..
C:\REPORT> CD..
C:\>
14. RD:-(Remove directory):- This command is used when we want to remove any unusable directory form our disk.
Syntax:- C:\> RD <Directory name>
C:\> RD REPORT

15. PATH:- This command is used for display or sets directories for executable files.
Synatx:- C:\> PATH 
This command display current path settings.

C:\> PATH=C:\WINDOWS\COMMAND;C:\WINDOWS\;C:\TC
this command will sets the directories windows, the command subfolder of windows and TC folder for executable files. Operating system will look for executable files in these directories.
NOTE:- If we need any help for above DOS commands the we put a '/?' symbol after writting the command at DOS prompt .
     Example:- C:\> DIR/?  or  C:\> COPY/?

 Wild card commands
Previous   |   Content  |   Next
Wildcard commands are used when we are working with multiple files instant of a single file at a time. These commands uses '?' and '*' symbol.
The '?' wildcard character
Suppose we want to list out all the files and directories which have primary file name made of four characters and secondary name made of 3 characters. then here we use DIR command with following switches
C:\> DIR ????.???
Here a '?' symbol represent that ? can be a any character or it may be special symbols.
Suppose we want to list out all the files which primary field name made of  4 characters, the first character start with 'C' and secondary name is 'EXE'. Then we uses
C:\> DIR C???.EXE
The '*' wildcard character
If we want to list all the files with extension .EXE the the command we give is-
C:\> DIR *.EXE
If we want to display all files with first character 'D' and extension 'EXE' in floppy disk, then we give the command
C:\> DIR A: D*.EXE
Some Internal commands with wild card
COPY:-If we have to copy the songs from our CD drive to our Hard disk. Then we suppose E:\ is our CD drive and we have to store all the songs in C:\ SONGS directory.
C:\> COPY   E:\ *.MP3   C:\ SONGS
REN:- If we want to rename all the files which have extension of 'TXT' to extension 'MSG' then we give the command
C:\> REN  *.TXT   *.MSG
DEL:- If we want to erase those files which have the extension of 'TMP' from our disk then we uses the command
C:\> DEL  *.TMP
If we use /p switch the computer give ask every time before deleting the file. If we enter 'Y' the it will erase the file from disk either it will leave the file.
 External commands
Previous   |    Content   |   Next
External commands are known as Disk residence commands. Because they can be store with DOS directory or any disk which is used for getting these commands. Theses commands help to perform some specific task. These are stored in a secondary storage device. Some important external commands are given below-

1. MORE:-Using TYPE command we can see the content of any file. But if length of file is greater than 25 lines then remaining lines will scroll up. To overcome through this problem we uses MORE command. Using this command we can pause the display after each 25 lines.
Syntax:- C:\> TYPE <File name> | MORE
C:\> TYPE ROSE.TXT | MORE
or
C:\> DIR | MORE
2. MEM:-This command displays free and used amount of  memory in the computer.
Syntax:- C:\> MEM
the computer will display the amount of memory.
3. SYS:- This command is used for copy system files to any disk. The disk having system files are known as Bootable Disk, which are used for booting the computer.
Syntax:- C:\> SYS [Drive name]
C:\> SYS A:
System files
 transferred 
This command will transfer the three main system files COMMAND.COM, IO.SYS, MSDOS.SYS to the floppy disk.
4. XCOPY:- When we need to copy a directory instant of a file from one location to another the we uses xcopy command. This command is much faster than copy command.
Syntax:- C:\> XCOPY < Source dirname >  <Target dirname>
C:\> XCOPY  TC TURBOC
5. MOVE:- Move command is used for moving one file or multiple files from one location to another location or from one disk to another disk.
Syntax:- C:\> MOVE  <file name>  <path name>
C:\SONGS> MOVE   *.MP3   C:\ SONGS\OLD SONGS\

C:\>
6. FC:-(File Compare) This command is capable for comparing two set of files and display difference between two files.
Syntax:- C:\> FC <First set of file>  <Second set of file>
C:\> FC ROSE.TXT GULAB.TXT
7.CHKDSK:-(Check disk) - This command is used to check the status of a disk and show the report of result status.
Syntax:- C:\> CHKDSK
C:\>CHKDSK

CHKDSK has NOT checked this drive for errors.
You must use SCANDISK to detect and fix errors on this drive.

Volume JAI created 10-19-2001 7:14p
Volume Serial Number is 3E42-1907

4,203,073,536 bytes total disk space
381,988,864 bytes available on disk

4,096 bytes in each allocation unit
1,026,141 total allocation units on disk
93,259 available allocation units on disk

651,264 total bytes memory
610,784 bytes free

Instead of using CHKDSK, try using SCANDISK. SCANDISK can reliably detect
and fix a much wider range of disk problems.
8. SORT:- This command is useful when we want to sort a file. When we run this command the result can be get to display device or file.
Syntax:- C:\> SORT /R  < Input file name>  <output file name>
Suppose we have a file Player.txt which having the list of a cricket player team and we want to sort the list of players, then we uses this command
C:\> SORT  Player.txt
If we not specify the output file name then result will show to the screen.
/R- switch is used for sorting the file in descending order like from Z to A or from 9 to 0.
9. FIND:- The FIND command is used to search a file for a text string. 
Syntax:- C:\> FIND "String to search" <File name>
C:\TEST>find "office" gulab.txt

---------- gulab.txt
A clock in a office can never get stolen
10. DISKCOPY:- DISKCOPY copies the contents of a floppy disk to another.
Syntax:- C:\> DISKCOPY  <Drive1>  <Drive2>
C:\> DISKCOPY  A:   B:
This command will be copy all contents of A drive to B drive.
11. ATTRIB:- Sets the various type of attribute to a file. Like Read only, Archive, Hidden and System attribute.
Syntax:- C:\> ATTRIB [± r] [± a] [± h] [± s] <File name>
here r  -  for read only,  a-  for archive, h  -  for hidden, s -  for hidden attribute.
C:\> ATTRIB +r  Gulab.txt
This command will change the attribute of file gulab.txt to read only mode. To remove the read only attribute we will follow this command.
C:\> ATTRIB -r Gulab.txt
12. LABEL:- If you are not happy with the volume label of hard disk, you can change it.
Syntax:- C:\> LABEL
C:\>LABEL
Volume in drive C is JAI
Volume Serial Number is 3E42-1907
Volume label (11 characters, ENTER for none)? INFOWAY
13. DOSKEY:- Once we install doskey , our dos will star to memorize all commands we uses. We can recall those commands using up or down arrow keys. It also gives the facility to create macros, which creates a short key for long keyword or command. 
Key function for Doskey are given as-
UP,DOWN
arrows recall commands
Esc
clears current command
F7
displays command history
Alt+F7
clears command history
F9
selects a command by number
Alt+F10
clears macro definitions
Syntax:- C:\> DOSKEY
DOSKey
 installed
Creating Macros:-
C:\>doskey t=time

C:\>t
C:\>time
Current time is 3:39:05.97p
Enter new time:

To list out all macros defined just type DOSKEY/MACROS at dos prompt and press enter.
C:\>DOSKEY/MACROS
$D=date
T=time
14. FORMAT:- This command creates new Track & Sectors in a disk. Every
Syntax:- C:\> FORMAT  [drive name] [/S]
C:\> FORMAT A:
this command will create new track & sectors.
C:\> FORMAT A: /S
This command will transfer system files after formatting the disk.
  Edit
Previous   |    Content   
Edit is an external way to create or modify any file. Edit meant Editor is very good utility for creating or modifying any file.
To start Edit type Edit on dos prompt and press enter. Then a full screen  window will appear like this-

File label displays the current file name which is open in the current window. If file name is not specified then  Untitled will be show.
A menu bar contains various commands. Which are given in detail. Select the items from menu and click.

FILE- We can activate File menu by pressing Alt+F key. 
New:- New command open a new window for creating new file with file name Untitled.
Open..:- If we want to open any existing file for modification or for any purpose then we choose this option. After selecting this option a dialog box will be appear, which looks like
We enter the file to be open in File Name box and press enter, or press down arrow key to choose from the given Files menu.

Save:- Suppose we have do some editing in the file and want to store it in disk then If the file which is currently in use have a file name. the editor will store all these editing with this specified file name either if it is Untitled then a save as dialog box will be appear which will ask a new file name to store these editing, which looks like this-
We enter a new file name in File Name field and press enter.
Save As...:- Some time we need a copy of any existing file with minor changing. Like if we are writing a letter to few consumers with same message but with different name and address. At that time Save As option helps us to save our time. We create a letter for one consumer and save that file with his name, again after changing the name and address of file for next consumer we Save As the file with next consumer name and so on for others.
This option is same like as copy command of DOS. But it helps when we are going to use the file systems like Mail Merge.
Close:- Close option is give for close the current open file.
Print...:- Edit have a very excellent feature to print a file. Open the file and from File->Print chose the complete document option and press enter. This will print all the document at a time.
If we want to print only selected text means only a small part of file then we choose Selected Text Only option after selecting the text and press enter.
Exit:- To close Edit and return to DOS prompt.

Edit:-All the commands available in this menu are related to editing the current open document. Before start editing we must need to select the text. The key combination for selecting the text are as given below-
SHIFT + LEFT ARROW
Select one character left
SHIFT + RIGHT ARROW
Select one character right
SHIFT + DOWN ARROW
Select one line below the current line
SHIFT + UP ARROW
Select one line up to the current line
SHIFT + CTRL + LEFT ARROW
Select one word left
SHIFT + CTRL + RIGHT ARROW
Select one word right
SHIFT + HOME
Select to beginning of current line from current cursor position.
SHIFT + END
Select to End of line from current cursor position.
CUT:- Cut option remove  the selected text and store them to the memory buffer. The sort key for cut is CTRL + X.
COPY:- Copy option copy the selected text into memory buffer. selected text can be copied also by pressing CTRL + C
PASTE:- Paste will insert the text store in computers buffer to the current cursor position. It can be achieved by pressing CTRL + V button.
CLEAR:- We can delete the selected text for ever by clear option. This command is useful when we need to delete a long paragraph or more than a line. We select the whole line by pressing SHIFT + DOWN ARROW key and after selection just press DEL key the sort key for this option.

Search:- This menu contains the items for searching and replacing the text of document. This facility provide very powerful feature when we have to replace text with another text in a large document.
Find:- We can find any text in the current document. For that at first go to the top of document. Select Search->Find . In appeared window type text to be search in Find what field.
 Repeat last find:- From Find edit will search only once the text we type on the Find What field. If we want to search same text , the we select Search->Repeat Last Find or just press F3button.
Replace:- Edit gives the facility to search a text and replace that text with other upon your choice. Suppose we want to replace all HEMAN we uses in current document with MACROMAN then we select Replace from Search->Replace... and press enter. In appeared window  we type HEMAN in Find what field and type in MACROMAN in Replace with field.
Select Replace button to replace only first find text otherwise select Replace All to replace all HEMAN with MACROMAN without asking any more for replace.

View:- We can open more than a file into edit. We can open upto 9 files at a time into editor. View option gives the facility to reload these currently loaded files. We can display two files at a time after splitting current window in two parts. Both different window may contain different files in each.
Split Window:- As declared above that we can open  two files at same time in two different window. Place the cursor in the document after which we have to split the window and select View->Split Window option.
Resize Window:- To change the size of each window we select this option. To change the size of the selected window select View->Resize Window and press enter.  The divider between two files will change to resizable cursor, which can be move up or down using up and down arrow key. To fix the size press enter key.
Close Window:- If you are not more need of two window, place the cursor in one which you want to close and select View->Close Window. Second window will maximize to full screen mode. 

Option:- This menu contains the items for changing settings for editor like setting of printer port, tab spacing and color management.
Settings...:- This option is used for set tab spacing and printer port setting.


Color:- Editor's screen color can be set up with your own choice. These screen color includes color of Menu bar, color of  scroll bar, status bar, window border, text color, background color and many more.
To set default color of edit just press Default button from this dialog box. Edit will restore it's own color management.

Learning MS-DOS Basics - A Tutorial This tutorial gives you an opportunity to try basic MS-DOS commands. By following the procedures in this section, you will learn to: o View the contents of a directory o Change from one directory to another o Create and delete directories o Change from one drive to another o Copy files o Rename files o Delete files o Format a floppy disk The Command Prompt When you first turn on your computer, you will see some cryptic information flash by. MS-DOS displays this information to let you know how it is configuring your computer. You can ignore it for now. When the information stops scrolling past, you'll see the following: C:\> This is called the command prompt or DOS prompt. The flashing underscore next to the command prompt is called the cursor. The cursor shows where the command you type will appear. Typing a Command This section explains how to type a command at the command prompt and demonstrates the "Bad command or file name" message. • To type a command at the command prompt 1. Type the following at the command prompt (you can type the command in either uppercase or lowercase letters): nul If you make a typing mistake, press the BACKSPACE key to erase the mistake, and then try again. 2. Press ENTER. You must press ENTER after every command you type. The following message appears: Bad command or file name The "Bad command or file name" message appears when you type something that MSDOS does not recognize. Because nul is not a valid MS-DOS command, MS-DOS displays the "Bad command or file name" message. 3. Now, type the following command at the command prompt: ver The following message appears on your screen: MS-DOS version 6.22 Viewing the Contents of a Directory In this section, you will view the contents of a directory by using the dir command. The dir command stands for "directory." • To view the contents of a directory 1. Type the following at the command prompt: dir A list similar to the following appears: Volume in drive C is MS-DOS_6.22 Volume Serial Number is lE49-15E2 Directory of C:\ WINDOWS
09-08-92 10:27p TEMP
05-15-92 12:09p CONFIG SYS 278 09-23-92 10:50a COMMAND COM 53014 09-18-92 6:00a WINA20 386 9349 11-11-91 5:00a DOS
09-02-92 4:23p AUTOEXEC BAT 290 09-23-92 10:54a 7 file(s) 62931 bytes 8732672 bytes free This is called a directory list. A directory list is a list of all the files and subdirectories that a directory contains. In this case, you see all the files and directories in the main or root directory of your drive. All the files and directories on your drive are stored in the root directory. Changing Directories Look at the list on your screen. All the names that have
beside them are directories. You can see a list of the files in another directory by changing to that directory, and then using the dir command again. In this case, you will change to the DOS directory. Before you begin this section, make sure you have a directory named DOS by carrying out the following procedure. o To make sure you have a directory named Windows 1.If you do not see a line in the directory list indicating that you have a directory named Windows, type the following at the command prompt: dir /s Windows You will see a message that includes a line such as the following: Directory of C:\DIRNAME o To change from the root directory to the WINDOWS directory To change directories, you will use the cd command. The cd command stands for "change directory." 1. Type the following at the command prompt: cd windows The command prompt changes. It should now look like the following: C:\WINDOWS> Next, you will use the dir command to view a list of the files in the DOS directory. o To view a list of the files in the WINDOWS directory 1. Type the following at the command prompt: dir A list of the files in the WINDOWS directory appears, but scrolls by too quickly to read. You can modify the dir command so that it displays only one screen of information at a time. o To view the contents of a directory one screen at a time 1. Type the following at the command prompt: dir /p One screen of information appears. At the bottom of the screen, you will see the following message: Press any key to continue . . . 2. To view the next screen of information, press any key on your keyboard. Repeat this step until the command prompt appears at the bottom of your screen. When you typed the dir command this time, you included the /p switch after the command. A switch modifies the way MS-DOS carries out a command. Generally, a switch consists of a forward slash (/) that is followed by one or more letters or numbers. When you used the /p switch with the dir command, you specified that MS-DOS should pause after it displays each screen of directory list information. The p actually stands for "page" Another helpful switch you can use with the dir command is the /w switch. The /w switch indicates that MS-DOS should show a wide version of the directory list. o To view the contents of a directory in wide format 1. Type the following at the command prompt: dir /w The directory list appears, with the filenames listed in wide format. Note that only filenames are listed. No information about the files' size or date and time of creation appears. 2. If the directory contains more files than will fit on one screen, you can combine the /p and /w switches as follows: dir /w /p Changing Back to the Root Directory Next, you will change from the DOS directory to the root directory. The root directory is the directory you were in before you changed to the DOS directory. Before you begin this section, make sure your command prompt looks like the following: C:\DOS> o To change to the root directory 1. Type the following at the command prompt: cd \ Note that the slash you type in this command is a backslash (\), not a forward slash (/). No matter which directory you are in, this command always returns you to the root directory of a drive. The root directory does not have a name. It is simply referred to by a backslash (\). The command prompt should now look like the following: C:\> When your command prompt appears similar to this---that is, when it does not contain the name of a directory---you are in the root directory. Creating a Directory In this section, you will create two directories. Creating a directory is helpful if you want to organize related files into groups to make them easy to find. Before you begin this section, make sure the command prompt looks like the following: C:\> To create a directory, you will use the md command. The md command stands for "make directory." o To create and change to a directory named FRUIT 1. Type the following at the command prompt: md fruit You have now creat ed a directory named FRUIT. You won't see the new FRUIT directory until you carry out the dir command in the next step. 2. To confirm that you successfully created the FRUIT directory, type the following at the command prompt: dir or dir /p Look through the directory list. A new entry somewhere in the list should look similar to the following: FRUIT
09-25-93 12:09p 3. To change to the new FRUIT directory, type the following at the command prompt: cd fruit The command prompt should now look like the following: C:\FRUIT> You will now create a directory within the FRUIT directory, named GRAPES. o To create and work with a directory named GRAPES 1. Type the following at the command prompt: md grapes You will not see the new GRAPES directory until you carry out the dir command in the next step. 2. To confirm that you successfully created the GRAPES directory, type the following at the command prompt: dir A list similar to the following appears: Volume in drive C is MS-DOS-6 Volume Serial Number is lE49-15E2 Directory of C:\FRUIT .
09-25-93 12:08p ..
09-25-93 12:08p GRAPES
09-25-93 12:10p 3 file(s) 0 bytes 11534336 bytes free Note that there are three entries in the FRUIT directory. One is the GRAPES directory that you just created. There are two other entries---one looks like a single period (.) and the other looks like a double period (..). These directory entries are important to MSDOS, but you can ignore them. They appear in every directory and cont ain information relation to the directory structure. The GRAPES directory is a subdirectory of the FRUIT directory. A subdirectory is a directory within another directory. Subdirectories are useful if you want to further subdivide information. 3. To change to the GRAPES directory, type the following at the command prompt: cd grapes The command prompt should now look like the following: C:\FRUIT\GRAPES> 4. To switch back to the FRUIT directory, type the following: cd .. The command prompt should now look like the following: C:\FRUIT> When the cd command is followed by two periods (..), MS-DOS moves up one level in the directory structure. In this case, you moved up one level from the GRAPES directory to the FRUIT directory. Deleting a Directory If you no longer use a particular directory, you may want to delete it to simplify your directory structure. Deleting a directory is also useful if you type the wrong name when you are creating a directory and you want to delete the incorrect directory before creating a new one. In this section, you will delete the GRAPES directory. Before you begin this section, make sure the command prompt looks like the following: C:\FRUIT> To delete a directory, use the rd command. The rd command stands for "remove directory." o To delete the GRAPES directory 1. Type the following at the command prompt: rd grapes 2. To confirm that you successfully deleted the GRAPES directory, type the following at the command prompt: dir The GRAPES directory should no longer appear in the directory list. Note You cannot delete a directory if you are in it. Before you can delete a directory, you must make the directory that is one level higher the current directory. To do this, type cd.. at the command prompt. Changing Drives This section describes how to change drives. Changing drives is useful if you want to work with files that are on a different drive. So far, you have been working with driveC. You have other drives you can use to store information. For example, drive A is your first floppy disk drive. The files and directories on drive A are located on the floppy disk in the drive. (You might also have a drive B, which contains the files and directories stored on the floppy disk in that drive.) Before you begin this section, make sure your command prompt looks like the following: C:\FRUIT> o To change to and view files on a different drive 1. Insert a 3.5" floppy disk in drive A label- side up. Make sure the disk clicks into the drive. 1. Type the following at the command prompt: a: Note that the command prompt changed to the following: A:\> This message may appear: Not ready reading drive A Abort, Retry, Fail? If you see this message, the disk may not be inserted properly. Place the disk label-side up in the disk drive, and make sure the disk clicks into the disk drive. Then, type r for Retry. If this message appears again, press F for Fail, and then type b: at the command prompt. If you no longer see this message, type b: instead of a: throughout the rest of the tutorial. There must be a floppy disk in the drive that you want to change to. 2. Change back to drive C by typing the following at the command prompt: c: Your command prompt should return to the following: C:\FRUIT> When you type a drive letter followed by a colon, you change to that drive. The drive letter that appears in the command prompt shows which drive is the current drive. Unless you specify otherwise, any commands you type are carried out on the current drive and in the current directory. So far, all the commands you typed were carried out on the current drive and in the current directory. You can also carry out a command on a drive that isn't current. For example, you can view the files on a disk in drive A without switching to drive A by following this procedure. o To view the contents of the WINDOWS directory on drive C 1. Type the following at the command prompt: dir c:\windows A list of the files in the DOS directory on drive C should scroll past on your screen. Copying Files This section describes how to copy a single file and a group of files. Copying files creates a duplicate of the original file and does not remove the original file. This is useful for many reasons. For example, if you want to work on a document at home, you can copy it from your computer at work to a floppy disk and then take the floppy disk home. To copy a file, you will use the copy command. When you use the copy command, you must include two parameters. The first is the location and name of the file you want to copy, or the source. The second is the location to which you want to copy the file, or the destination. You separate the source and destination with a space. The copy command follows this pattern: copy source destination • Copying a Single File In this section, you will copy the notepad.exe files from the WINDOWS directory to the FRUIT directory. You will specify the source and destination of these files in two different ways. The difference between the two methods is explained at the end of this section. Before you begin this section, make sure the command prompt looks like the following: C:\FRUIT> To copy the NOTEPAD.EXE files from the WINDOWS directory to the FRUIT directory 1. Return to the root directory by typing the following at the command prompt: cd\ The command prompt should now look like the following: C:\> Change to the DOS directory by typing the following at the command prompt: cd windows The command prompt should now look like the following: C:\WINDOWS> 2. Make sure the file you are going to copy, NOTEPAD.EXE, is located in the WINDOWS directory by using the dir command followed by a filename. dir notepad.exe A list similar to the following appears: 3. To copy the NOTEPAD.EXE file from the WINDOWS directory to the FRUIT directory, type the following at the command prompt: copy c:\windows\notepad.exe c:\fruit The following message appears: 1 file(s) copied 4. To confirm that you copied the files successfully, view the contents of the FRUIT directory by typing the following at the command prompt: dir \fruit You should see the file listed in the FRUIT directory. Renaming Files This section explains how to rename files. You may want to rename a file if the information in it changes or if you decide you prefer another name. To rename a file, you will use the ren command. The ren command stands for "rename." When you use the ren command, you must include two parameters. The first is the file you want to rename, and the second is the new name for the file. You separate the two names with a space. The ren command follows this pattern: ren oldname newname • Renaming a File In this section, you will rename the README.TXT file. Before you begin this section, make sure your command prompt looks like the following: C:\FRUIT> 1. To rename the NOTEPAD.EXE file to PADNOTE.TXT, type the following at the command prompt: ren notpad.exe padnote.txt 2. To confirm that you renamed the file successfully, type the following at the command prompt: dir Deleting Files This section explains how to delete, or remove, a file that you no longer want on your disk. If you don’t have very much disk space, deleting files you no longer use is essential. To delete a file, you will use the del command. The del command stands for "delete." • Deleting a File In this section, you will delete two files using the del command. Before you begin, make sure your command prompt looks like the following: C:\FRUIT> To delete the PEARCOM and PEAR.HLP files 1. Delete the PADNOTE.TXT file by typing the following at the command prompt: del PADNOTE.TXT 2. To confirm that you deleted the files successfully, type the following at the command prompt: dir • Deleting a Group of Files In this section, you will use wildcards to delete a group of files. Before you begin this section, make sure your command prompt looks like the following: C:\FRUIT> To delete files in the current directory that end with the extension OLD by using wildcards 1. View all files that end with the extension OLD by typing the following at the command prompt: dir *.old A list of all the files that end with the extension OLD appears. Make sure that these are the files you want to delete. When you are deleting files by using wildcards, this step is very important. It will prevent you from deleting files accidentally. 2. Delete all files ending with OLD by typing the following at the command prompt: del *.old 3. To confirm that all the files with the extension OLD have been deleted, type the following at the command prompt: dir The FRUIT directory should contain no files. Now that the FRUIT directory is empty, you can delete it by using the rd (remove directory) command that you learned to use in "Deleting a Directory" earlier in this chapter. • To delete the FRUIT directory 1. Return to the root directory by typing the following at the command prompt: cd \ 2. You can see the FRUIT directory in the directory list by typing the following at the command prompt: dir or dir /p 3. Remove the FRUIT directory by typing the following at the command prompt: rd fruit 4. To verify that the FRUIT directory has been removed, type the following at the command prompt: dir or dir /p The FRUIT directory should not appear in the directory list.
INTERNAL COMMAND
The syntax and usage of selected DOS internal commands, including: TIME, DATE, CLS, DIR, COPY, TYPE, DEL, REN, RD, MD, CD, PATH, and SET PROMPT.
DOS Internal Commands
The DOS (Windows 9x) internal commands are so-called because their instructions are a part of COMMAND.COM, the DOS (Windows 9x) command processor. 

Recall that COMMAND.COM is placed into memory each time the DOS or Windows 9x OS is booted. Therefore, the internal commands are always in memory and can always be executed from any command line prompt.
 

This is in contrast to the disk-bound external commands, which reside in secondary memory up until the moment they are needed, at which time the OS must find them and load them into primary memory.
 

The syntax for some frequently used internal commands follows.
TIME 
Displays current time and allows it to be changed.
 
Syntax:
TIME
DATE 
Displays current date and allows it to be changed.
 
Syntax:
DATE
CLS 
Clears the screen.
 
Syntax:
CLS
DIR 
Shows directory information of a diskette: name, size, and the date and time stamp of files.
 
Syntax:
DIR [d:][path]
Optional switches:
/p Display dir info and pauses display when the screen is full
/w Display names and extensions only in five columns

To display a file directory listing for D:\DATA\LETTER\ANNUAL from different current directories:
D:\DATA\LETTER\ANNUAL> DIR
D:\DATA> DIR LETTER\ANNUAL
C:\WINDOWS> DIR D:\DATA\LETTER\ANNUAL
<="" a="" style="color: rgb(0, 0, 0); font-family: arial; font-size: medium; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;">COPY
Copies a file. Name of copy may be the same as original, or different. Syntax:
COPY [d:][path][name.ext] [d:][path][name.ext]
Optional switches:
/v Verify, copies the file and compares it with the original
/b Binary file

To copy a file from D:\BATCH to the root of A: drive
A:\> COPY D:\BATCH\CL.BAT (from A: drive)
D:\BATCH> COPY CL.BAT A:\ (from D:\BATCH)
To copy a file from the root of C: to A: drive and change its name
A:\> COPY C:\MSDOS.SYS MSDOSSYS.BAK (from A:)
C:\> COPY MSDOS.SYS A:\MSDOSSYS.BAK (from the root of C:)
To copy all of the files from the root of A: to D:\CCV\ENGCOMP
A:\> COPY *.* D:\CCV\ENGCOMP (from A:)
D:\CCV\ENGCOMP> COPY *.* A:\ (from D:\CCV\ENGCOMP)
TYPE
Displays the contents of a file.
Syntax:
TYPE [d:][path][name.ext]

To display the contents of the file MY.LET to the screen
A:\> TYPE MY.LET
DEL
Deletes a file from disk.
Syntax:
DEL [d:][path][name.ext]

To delete one file:
A:\> DEL A:\MY.LET
To del all files in current directory
A:\> DEL *.*
REN
Renames a file.
Syntax:
REN [d:][path][name.ext] [d:][path][newname.ext] 

To change the name of the file D:\LET\ANNUAL\99.DOC to 1999.DOC
D:\LET> REN ANNUAL\99.DOC 1999.DOC (from D:\LET)
D:\DATA> REN \LET\ANNUAL\99.DOC 1999.DOC (from D:\DATA)
C:\WINDOWS> REN D:\LET\ANNUAL\99.DOC 1999.DOC (from C:\WINDOWS)
MD
Makes (creates) a new directory.
Syntax:
MD [d:][path][dirname]

To create a directory named HERMIT in the root of D: drive
D:\> MD HERMIT (from D:\)
C:\> MD D:\HERMIT (from C:\)
RD
Removes an existing directory (directory must be empty).
Syntax:
RD [d:][path][dirname]

To remove the HERMIT sub-directory:
D:\> RD HERMIT (from D:\)
C:\> RD D:\HERMIT (from C:\)
CD
Changes the current directory.
Syntax:
CD [path][dirname]

To make D:\HERMIT the current directory
D:\> CD HERMIT (from D:\)
D:\DATA> CD \HERMIT (from D:\DATA)
D:\DATA\SOURCE> CD \HERMIT (from D:\DATA\SOURCE)
D:\DATA\SOURCE> CD .. (from D:\DATA\SOURCE)
PATH
The PATH command is used to help the command interpreter find external commands which are not in the current directory. The command interpreter looks into the 
DOS environment for "PATH=" and then searches the paths (each separated from the next by a semicolon) that follow. 
Syntax:
PATH=[path;path;...] 

To set the DOS PATH:
PATH=C:\DOS;C:\PCW;\C:\BIN
To display the current path:
PATH
SET PROMPT 
Used to specify the appearance of the DOS prompt.
 
Syntax:
SET PROMPT= (from the command line)

PROMPT= (in a batch file)
      DOS PROMPT Characters
      $b    |                      $d   system date
      $e    esc char               $g   >
      $h    destructive bk space   $i   <
      $n    default drive          $p   full path description
      $q    =                      $t   system time
      $v    DOS version no         $_   CR and LF
      $$    the $ sign

To display current drive & current path followed by ">" as prompt
SET PROMPT=$P$G
To display the current date, time, and drive on separate lines
SET PROMPT $D$_$T$_$N$G
To redefine F9 to CD\Windows\Start Menu\Programs\Startup
SET PROMPT $e[0,67;"'CD\Windows\Start Menu\Programs\Startup'";13p
EXTEYRNAL COMMAND
 External commands
Previous   |    Content   |   Next
External commands are known as Disk residence commands. Because they can be store with DOS directory or any disk which is used for getting these commands. Theses commands help to perform some specific task. These are stored in a secondary storage device. Some important external commands are given below-

1. MORE:-Using TYPE command we can see the content of any file. But if length of file is greater than 25 lines then remaining lines will scroll up. To overcome through this problem we uses MORE command. Using this command we can pause the display after each 25 lines.
Syntax:- C:\> TYPE <File name> | MORE
C:\> TYPE ROSE.TXT | MORE
or
C:\> DIR | MORE
2. MEM:-This command displays free and used amount of  memory in the computer.
Syntax:- C:\> MEM
the computer will display the amount of memory.
3. SYS:- This command is used for copy system files to any disk. The disk having system files are known as Bootable Disk, which are used for booting the computer.
Syntax:- C:\> SYS [Drive name]
C:\> SYS A:
System files
 transferred 
This command will transfer the three main system files COMMAND.COM, IO.SYS, MSDOS.SYS to the floppy disk.
4. XCOPY:- When we need to copy a directory instant of a file from one location to another the we uses xcopy command. This command is much faster than copy command.
Syntax:- C:\> XCOPY < Source dirname >  <Target dirname>
C:\> XCOPY  TC TURBOC
5. MOVE:- Move command is used for moving one file or multiple files from one location to another location or from one disk to another disk.
Syntax:- C:\> MOVE  <file name>  <path name>
C:\SONGS> MOVE   *.MP3   C:\ SONGS\OLD SONGS\

C:\>
6. FC:-(File Compare) This command is capable for comparing two set of files and display difference between two files.
Syntax:- C:\> FC <First set of file>  <Second set of file>
C:\> FC ROSE.TXT GULAB.TXT
7.CHKDSK:-(Check disk) - This command is used to check the status of a disk and show the report of result status.
Syntax:- C:\> CHKDSK
C:\>CHKDSK

CHKDSK has NOT checked this drive for errors.
You must use SCANDISK to detect and fix errors on this drive.

Volume JAI created 10-19-2001 7:14p
Volume Serial Number is 3E42-1907

4,203,073,536 bytes total disk space
381,988,864 bytes available on disk

4,096 bytes in each allocation unit
1,026,141 total allocation units on disk
93,259 available allocation units on disk

651,264 total bytes memory
610,784 bytes free

Instead of using CHKDSK, try using SCANDISK. SCANDISK can reliably detect
and fix a much wider range of disk problems.
8. SORT:- This command is useful when we want to sort a file. When we run this command the result can be get to display device or file.
Syntax:- C:\> SORT /R  < Input file name>  <output file name>
Suppose we have a file Player.txt which having the list of a cricket player team and we want to sort the list of players, then we uses this command
C:\> SORT  Player.txt
If we not specify the output file name then result will show to the screen.
/R- switch is used for sorting the file in descending order like from Z to A or from 9 to 0.
9. FIND:- The FIND command is used to search a file for a text string. 
Syntax:- C:\> FIND "String to search" <File name>
C:\TEST>find "office" gulab.txt

---------- gulab.txt
A clock in a office can never get stolen
10. DISKCOPY:- DISKCOPY copies the contents of a floppy disk to another.
Syntax:- C:\> DISKCOPY  <Drive1>  <Drive2>
C:\> DISKCOPY  A:   B:
This command will be copy all contents of A drive to B drive.
11. ATTRIB:- Sets the various type of attribute to a file. Like Read only, Archive, Hidden and System attribute.
Syntax:- C:\> ATTRIB [± r] [± a] [± h] [± s] <File name>
here r  -  for read only,  a-  for archive, h  -  for hidden, s -  for hidden attribute.
C:\> ATTRIB +r  Gulab.txt
This command will change the attribute of file gulab.txt to read only mode. To remove the read only attribute we will follow this command.
C:\> ATTRIB -r Gulab.txt
12. LABEL:- If you are not happy with the volume label of hard disk, you can change it.
Syntax:- C:\> LABEL
C:\>LABEL
Volume in drive C is JAI
Volume Serial Number is 3E42-1907
Volume label (11 characters, ENTER for none)? INFOWAY
13. DOSKEY:- Once we install doskey , our dos will star to memorize all commands we uses. We can recall those commands using up or down arrow keys. It also gives the facility to create macros, which creates a short key for long keyword or command. 
Key function for Doskey are given as-
UP,DOWN
arrows recall commands
Esc
clears current command
F7
displays command history
Alt+F7
clears command history
F9
selects a command by number
Alt+F10
clears macro definitions
Syntax:- C:\> DOSKEY
DOSKey
 installed
Creating Macros:-
C:\>doskey t=time

C:\>t
C:\>time
Current time is 3:39:05.97p
Enter new time:

To list out all macros defined just type DOSKEY/MACROS at dos prompt and press enter.
C:\>DOSKEY/MACROS
$D=date
T=time
14. FORMAT:- This command creates new Track & Sectors in a disk. Every
Syntax:- C:\> FORMAT  [drive name] [/S]
C:\> FORMAT A:
this command will create new track & sectors.
C:\> FORMAT A: /S
This command will transfer system files after formatting the disk.
  Edit
Previous   |    Content   
Edit is an external way to create or modify any file. Edit meant Editor is very good utility for creating or modifying any file.
To start Edit type Edit on dos prompt and press enter. Then a full screen  window will appear like this-

File label displays the current file name which is open in the current window. If file name is not specified then  Untitled will be show.
A menu bar contains various commands. Which are given in detail. Select the items from menu and click.

FILE- We can activate File menu by pressing Alt+F key. 
New:- New command open a new window for creating new file with file name Untitled.
Open..:- If we want to open any existing file for modification or for any purpose then we choose this option. After selecting this option a dialog box will be appear, which looks like
We enter the file to be open in File Name box and press enter, or press down arrow key to choose from the given Files menu.

Save:- Suppose we have do some editing in the file and want to store it in disk then If the file which is currently in use have a file name. the editor will store all these editing with this specified file name either if it is Untitled then a save as dialog box will be appear which will ask a new file name to store these editing, which looks like this-
We enter a new file name in File Name field and press enter.
Save As...:- Some time we need a copy of any existing file with minor changing. Like if we are writing a letter to few consumers with same message but with different name and address. At that time Save As option helps us to save our time. We create a letter for one consumer and save that file with his name, again after changing the name and address of file for next consumer we Save As the file with next consumer name and so on for others.
This option is same like as copy command of DOS. But it helps when we are going to use the file systems like Mail Merge.
Close:- Close option is give for close the current open file.
Print...:- Edit have a very excellent feature to print a file. Open the file and from File->Print chose the complete document option and press enter. This will print all the document at a time.
If we want to print only selected text means only a small part of file then we choose Selected Text Only option after selecting the text and press enter.
Exit:- To close Edit and return to DOS prompt.

Edit:-All the commands available in this menu are related to editing the current open document. Before start editing we must need to select the text. The key combination for selecting the text are as given below-
SHIFT + LEFT ARROW
Select one character left
SHIFT + RIGHT ARROW
Select one character right
SHIFT + DOWN ARROW
Select one line below the current line
SHIFT + UP ARROW
Select one line up to the current line
SHIFT + CTRL + LEFT ARROW
Select one word left
SHIFT + CTRL + RIGHT ARROW
Select one word right
SHIFT + HOME
Select to beginning of current line from current cursor position.
SHIFT + END
Select to End of line from current cursor position.
CUT:- Cut option remove  the selected text and store them to the memory buffer. The sort key for cut is CTRL + X.
COPY:- Copy option copy the selected text into memory buffer. selected text can be copied also by pressing CTRL + C
PASTE:- Paste will insert the text store in computers buffer to the current cursor position. It can be achieved by pressing CTRL + V button.
CLEAR:- We can delete the selected text for ever by clear option. This command is useful when we need to delete a long paragraph or more than a line. We select the whole line by pressing SHIFT + DOWN ARROW key and after selection just press DEL key the sort key for this option.

Search:- This menu contains the items for searching and replacing the text of document. This facility provide very powerful feature when we have to replace text with another text in a large document.
Find:- We can find any text in the current document. For that at first go to the top of document. Select Search->Find . In appeared window type text to be search in Find what field.
 Repeat last find:- From Find edit will search only once the text we type on the Find What field. If we want to search same text , the we select Search->Repeat Last Find or just press F3button.
Replace:- Edit gives the facility to search a text and replace that text with other upon your choice. Suppose we want to replace all HEMAN we uses in current document with MACROMAN then we select Replace from Search->Replace... and press enter. In appeared window  we type HEMAN in Find what field and type in MACROMAN in Replace with field.
Select Replace button to replace only first find text otherwise select Replace All to replace all HEMAN with MACROMAN without asking any more for replace.

View:- We can open more than a file into edit. We can open upto 9 files at a time into editor. View option gives the facility to reload these currently loaded files. We can display two files at a time after splitting current window in two parts. Both different window may contain different files in each.
Split Window:- As declared above that we can open  two files at same time in two different window. Place the cursor in the document after which we have to split the window and select View->Split Window option.
Resize Window:- To change the size of each window we select this option. To change the size of the selected window select View->Resize Window and press enter.  The divider between two files will change to resizable cursor, which can be move up or down using up and down arrow key. To fix the size press enter key.
Close Window:- If you are not more need of two window, place the cursor in one which you want to close and select View->Close Window. Second window will maximize to full screen mode. 

Option:- This menu contains the items for changing settings for editor like setting of printer port, tab spacing and color management.
Settings...:- This option is used for set tab spacing and printer port setting.


Color:- Editor's screen color can be set up with your own choice. These screen color includes color of Menu bar, color of  scroll bar, status bar, window border, text color, background color and many more.
To set default color of edit just press Default button from this dialog box. Edit will restore it's own color management.


up vote17down votefavorite
5
The color command has to do with changing color of windows command promt background/text
color 0A - where 0 is the background color and A is the text color
I want to change these color of text every 1 second in windows batch script using an array with 1,2,3,4,5,6,7,8,9,A,B,C,D,E,F witch are the color codes.
0 = Black       8 = Gray
1 = Blue        9 = Light Blue
2 = Green       A = Light Green
3 = Aqua        B = Light Aqua
4 = Red         C = Light Red
5 = Purple      D = Light Purple
6 = Yellow      E = Light Yellow
7 = White       F = Bright White
the command should be go every second like this
color 01
color 02
color 03
....
color 0E
color 0F
and for these i found some little script but im not sure how to make it work to change the color for every 1 second!
for /L %%i in (1,1,%n%) do echo !array[%%i]!
or this
@echo off CLS
for /l %%a in (15,-1,1) do (
color 0A
cls
)
pause
or this
SET COUNTDOWN=15
:COUNTDOWNLOOP
IF %COUNTDOWN%==0 GOTO END
color 0A && %R1%
CLS
SET /A COUNTDOWN -=1
GOTO COUNTDOWNLOOP
:END


Comments