Getting started MS DOS
DOS stands for Disk Operating System. DOS controls the computer’s hardware and provides an environment for programs to run. This system program must always be present when working with your computer.
To start DOS you have to open up command prompt from windows:
Start>All programs>Accessories>command prompt
Basic DOS commands with example
<Drive letter>: command
1. To switch drive C: to drive D:
C:Usersapcl>D:
output
D:>
CD command:
1. Takes you to the top of the directory tree (typically to C:) .
C:Usersapcl>CD
Output
C:>
2. To moves you one level up the directory tree (i.e. up towards the root directory).
C:Usersapcl>CD..
Output
C:Users>
3. To takes you to any directory. You can use one or more subdirectory names, separated by
C:>CD wamp
output
C:wamp>
or
C:>CD wampwww
output
C:wampwww>
DIR command:
1. To displays all files and folders in the current directory. Folders are indicated in the list by <DIR>. Files are usually
listed by name
C:>DIR
output
2. More DIR commands with parameter
DIR /P displays the contents a page at a time, i.e. as many as will fit in your command line window. Press any key to
display the next page.
DIR /W displays the files/folders in multiple rows. This view gives less information per file.
DIR *.JPG displays all files with the extension JPG in the current directory and all subdirectories.
DIR MY??.* displays all files beginning with MY, exactly 4 characters long, and with any extension.
DIR /S lists the contents of all subdirectories.
DIR /AH displays all hidden files.
CLS command
1. To clear the screen
c:>CLS
ATTRIB command:
Change file attributes. '+' adds an attribute, '-' removes it. Attributes are: A=archive; R=read only; S=system;H=hidden.
1. To add hidden attribute for any file
C:Usersapcl>attrib +h c:my_db.sql
2. To remove hidden attribute for any file
C:Usersapcl>attrib -h c:my_db.sql
XCOPY command
1. To copy the single file myfile1.txt from c:wampwwwmysitemyfile.txt to d:ackup, type the following at the command
prompt;
C:Usersapcl>xcopy c:wampwwwmysitemyfile.txt d:ackup
Press Enter Then press D
Output
1 file(s) copied
2. To copy all files and folders from c:wampwwwmysite d:ackupmysite
C:Usersapcl>xcopy /e c:wampwwwmysite d:ackupmysite
Press Enter Then press D
3. To copy entire drive D: to E:
C:Usersapcl>xcopy /e D:*.* E:
MD command
1. To create folder/directory to d:myfolder
C:Usersapcl>md d:myfolder
RENAME command
1. To rename file from old_name.txt to new_name.txt in the same folder
C:Usersapcl>rename c:old_name.txt new_name.txt
2. To change all file extension JPG to jpg in a folder
C:Usersapcl>rename c:images*.JPG *.jpg
DEL command
1. To delete all files with the extension JPG at c: emp.
C:Usersapcl>DEL c: emp*.JPG
2. To delete all files beginning with MY and with any extension c: emp.
C:Usersapcl>DEL c: empMY*.*
3. To delete files that are 4 characters long and begin with MY and with any extension c: emp.
C:Usersapcl>DEL c: empMY??.*
Comments 0