Search Latest Tips & Tricks

Saturday, February 27, 2010

DOS LEARNING to handle the files (COMMAND PROMPT)

(1) click on START go to RUN and type CMD.EXE
(2) press ALT+TAB (this will enlarge the DOS window into full screen)
(3) type CD.. again and again till you get to the c drive (like C:\>)
(4) now type DIR (it will show all files & folders in C drive now look for the WINDOWS folder)
(5) type CD WINDOWS (it will change patch C:\> to C:\ windows> it means now windows folder has opened)
(6) type DIR again (you will find a long list of files passed with the blink of eye )
(7) to see all the files and folders in windows folder, type DIR/P (it pauses the flow of files after one screen )
(8) find the system32 folder, if you can’t then type simply CD SYSTEM32 (now the path is changed into C:\windows\system32>
(9) type DIR ( you will see a very long list of files exist in the system32 folder)
(10) To check the files and in trying to find some specific files, different characters are used with DIR command after forward slash (/) these are called switches, write these commands to understand switches:
DIR/P (Pauses after each screen full information) DIR/W (shows files in Wide format)
DIR/AH (shows all files with the Attribute Hidden)
DIR/AR (shows all files with the Attribute Read only)
DIR/AS (shows all files with the Attribute System)
DIR/AA (shows all files with the Attribute Achieve)
DIR/ON (shows all files in alphabetic Order Name wise) DIR/O-N (Reverse output)
DIR/OS (shows all files in the Order of Size smallest first) DIR/O-S (Reverse output)
DIR/OE (shows all files in alphabetic Order by the extension) DIR/O-E (Reverse output)
DIR/OD (shows all files in the Order of Date oldest first) Dir/O-D (Reverse Output)
DIR/B (shows files in Bare format )
DIR/S DIR/L DIR/X DIR/Q DIR/T DIR/4
(Check these commands and consider the result by your own)
You can also combine these commands switches with each other
e.g. DIR/W/P (shows files in Wide format And Pauses the flow of files)
now type CLS (this command will Clear The Screen)
What are the results of these commands? Think!
DIR/ON/P DIR/OS/W DIR/OS/W/P DIR/OD/ON/OS/P DIR/AH/AR/P
(11) There are two characters question mark (?) and asteric (*) which are called wild cards they are
Used to find out the files which names or extensions are unknown, type these commands to understand:
DIR *.EXE (displays all files which names are whatever but extension is .EXE)
DIR A*.* (displays all files which names start with A and extension is whatever)
DIR C??C.EXE (displays all files which name consists of 4 characters in which middle two characters are unknown and extension is .EXE)
DIR A*Z.E* (displays all files which name starts with A, ends with Z, middle characters are whatever and the extension’s 1st letter is E)
What is the result of these commands? Think!
DIR *A*.DLL DIR CH???K.EXE DIR *A*T*B.* DIR N*RR*R.EXE
DIR *.* DIR A*.D* DIR ?A?.* DIR *TASK*.exe
You can also combine switches and wildcards to get more accurate results, Check these commands in DOS:
DIR/P *.exe (it will show all .exe files and may pause the each running screen)
DIR/P/W A*.* (it will show all files of any extension which names starts with A and may be shown in wide format and pause the screen each time)
Now what is the result of these commands? Think!
DIR/AH C*B* DIR/ON/P A*Z.* DIR/O-S/W/P *.DLL DIR/B/P ?A????.EXE
DIR/AR/O-D/P *S*.D* DIR/AA/B/P *M*N*.* DIR *A*E*I*.*

(12) now type CD.. type again CD.. (till you get to the position C:\>)
(13) type D: then press enter (it will change prompt C:\> to D:\>)
(14) type MD PAKISTAN (it will make a folder named PAKISTAN in D: drive)
(15) type CD PAKISTAN (it will open PAKISTAN now path is D:\PAKISTAN>)
(16) type EDIT (DOS will upon EDIT program, it is like NOTEPAD to type the text)
(17) type any English story and then use the mouse to go to FILE menu then click on SAVE
In the FILE NAME type this D:\PAKISTAN\STORY.TXT (it will save a file named as STORY.TXT in the D drive and in PAKISTAN folder)
Now click on FILE and then click NEW and make another file ESSAY.TXT and write any essay in it. Then SAVE it in the same path e.g. D:\PAKISTAN\ESSAY.TXT you can also OPEN a file from the path where it was saved e.g. click on OPEN and type the path D:\PAKISTAN\STORY.TXT and click OK, it will open STORY.TXT file from the D drive and from PAKSITAN folder.
Make some other files like LETTER.TXT APPLICATION.TXT DIALOGUE.TXT and save it in the same path e.g. D:\PAKISTAN\LETTER.TXT
To close the EDIT program go to FILE menu and click on EXIT
(18) COPY is the command in DOS which is used to copy the files from one path to another. It is also used to combine text files and make a new file. suppose if you want to copy STORY.TXT from D drive and Pakistan folder (D:\PAKISTAN) to C Drive then you may write this command in DOS:
COPY D:\PAKISTAN\ C:\
It will show the output that “1 FILE COPIED”
And what if you want to copy all .TXT files from D:\PAKISTAN\ TO C:\?
Type COPY D:\PAKISTAN *.TXT C:\ (HINT: you can also use wildcards * ? with the files like in the above command)
Lets combine all the text files you have just created in Pakistan folder
Type COPY D:\PAKISTAN\ESSAY.TXT+STORY.TXT+LETTER.TXT C:\ENGLISH.TXT
It will combine 3 files : ESSAY.TXT, STORY.TXT, LETTER.TXT and make a new file ENGLISH.TXT by the combination of these three files
And whenever you want to copy files from CDROM or any DRIVE like E, F etc.
Type COPY then press space and then type the full path and file names with their extensions then type the path where you want to save the file, the following command will copy pictures (.JPG files) from E:\MY PICTURES to D:\MY FAMILY PICTURES
COPY E:\MY PICTURES\*.JPG D:\MY FAMILY PICTURES
(19) Here are some more useful commands used in DOS:
(i) TIME command is used to check the time and change the time, to change the time type TIME hh:mm:ss and then press enter where hh=current hours, mm=current minutes,ss=current seconds
Example: type TIME 12:30:30 ( it will change the time to 12:30:30)
(ii) DATE (is used to view the date and change the date, to change the date type DATE mm-dd-yyyy)
Example: type DATE 06-05-2009 (it will change the date to 06/05/2009
(iii) FORMAT command is used to format a drive (format erases all data in a drive and makes sectors and tracks for that drive in the hard disk)
Example: FORMAT D: (it will erase all data in the drive D , Becarefull to use this command)
(iv) DEL command is used to delete a file or a number of files.
Example1: DEL D:\PAKISTAN\ESSAY.TXT (it will delete ESSAY.TXT file from PAKISTAN directory in the D drive)
Example2: DEL D:\PAKISTAN\*.TXT (it will delete all .TXT files)
(v) RD command is used to remove an empty folder (directory)
Example: RD D:\PAKISTAN
(vi) TREE command is used to display the folder structure of a drive graphically
Examples: type TREE C: type TREE D: etc.
(vii) VER command is used to show the version of DOS
Example: type VER (check what the output comes)
NOTE: all commands are written here in uppercase letters (e.g. ABC) and all commands work when you press enter. Repeat the commands again and again to enhance your learning skills.

No comments:

Post a Comment

Please post your nice comments here