Home  • Operating System • DOS

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:\Users\apcl>D: output D:\> CD command: 1. Takes you to the top of the directory tree (typically to C:) . C:\Users\apcl>CD\ Output C:\> 2. To moves you one level up the directory tree (i.e. up towards the root directory). C:\Users\apcl>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 wamp\www output C:\wamp\www> 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:\Users\apcl>attrib +h c:\my_db.sql 2. To remove hidden attribute for any file C:\Users\apcl>attrib -h c:\my_db.sql XCOPY command 1. To copy the single file myfile1.txt from c:\wamp\www\mysite\myfile.txt to d:\backup, type the following at the command prompt; C:\Users\apcl>xcopy c:\wamp\www\mysite\myfile.txt d:\backup Press Enter Then press D Output 1 file(s) copied 2. To copy all files and folders from c:\wamp\www\mysite d:\backup\mysite C:\Users\apcl>xcopy /e c:\wamp\www\mysite d:\backup\mysite Press Enter Then press D 3. To copy entire drive D: to E: C:\Users\apcl>xcopy /e D:\*.* E:\ MD command 1. To create folder/directory to d:\myfolder C:\Users\apcl>md d:\myfolder RENAME command 1. To rename file from old_name.txt to new_name.txt in the same folder C:\Users\apcl>rename c:\old_name.txt new_name.txt 2. To change all file extension JPG to jpg in a folder C:\Users\apcl>rename c:\images\*.JPG *.jpg DEL command 1. To delete all files with the extension JPG at c:\temp. C:\Users\apcl>DEL c:\temp\*.JPG 2. To delete all files beginning with MY and with any extension c:\temp. C:\Users\apcl>DEL c:\temp\MY*.* 3. To delete files that are 4 characters long and begin with MY and with any extension c:\temp. C:\Users\apcl>DEL c:\temp\MY??.*

Comments 0