Command Prompt is a Command Line Interface (CLI) in Microsoft Windows which allows you to enter MS-DOS (Microsoft Disk Operating System) text commands. Before Operating Systems such as Windows which have a Graphic User Interface (GUI) there were only Command Line Interfaces where you had to type commands at the Command prompt to get the computer to do anything.
To open 'Command Prompt' then click 'Start'
, click 'All Programs'
, click 'Accessories'
, and select 'Command Prompt'. Alternatively, you can click 'Start'
, and enter 'Command Prompt' or 'CMD' into the text box and press 'Enter' on your keyboard.
The 'Command Prompt' should display a 'Drive Letter', the 'Directory', and a flashing cursor such as the following:
(This is the root directory of the C: Drive).
(This is the documents directory on the D: Drive).
Note that 'Directory' is the same as 'Folder'.
To see a list of commands that you can use then type 'Help'
into the 'Command Prompt' and press 'Enter' on the keyboard.
If you type 'Help' followed by a space and a command then press 'Enter' then it will give you more information on that command. Try the following to get information on the 'Dir' command:
(The command 'Dir' displays a list of files and sub-directories and allows you to use various 'Switches' or 'Options' with it.)
For example if you type 'Dir'
then press 'Enter', then compare it with 'Dir /B'
which also displays your files and sub-directories but in a cleaner (bare) format.
Below we will create a new Directory in the root directory of the C: Drive called 'testdirectory' and place a text file in it called 'textfile'. We will then rename the text file as 'newtextfile' before deleting the text file and the new Directory. Enter highlighted blue text only into a Command Prompt (Not the comments in the brackets):
CD C:\ (CD = current directory - root directory of the C: Drive).
MD testdirectory (MD = make directory - creates testdirectory).
Dir (This displays the new directory that you have created).
CD testdirectory (puts us inside testdirectory directory).
EDIT textfile.txt (Allows us to create a text file).
Enter 'Hello World' and then select 'File' and then 'Save'. To exit then select 'File' and then 'Exit'.
Dir (This displays the new text file that you have created).
If you type textfile.txt then Notepad will open and will display your message.
Ren textfile.txt newtextfile.txt (Ren = rename - from textfile to newtextfile).
Dir (This displays the renamed text file 'newtextfile').
Del newtextfile.txt (Del = Delete - Deletes your text file).
Dir (You will see that newtextfile.txt has gone).
CD C:\ (Takes you back to the root directory of the C: Drive).
Dir (You will see that testdirectory is listed).
RD testdirectory (RD = Remove directory - removes testdirectory).
Dir (You will see that testdirectory has gone).
Note that Windows 7 64-bit Operating System does not include the 'EDIT' command and instead you will need to use the Start command to open Notepad (Start Notepad) and save the file into C:\testdirectory
You must delete all the files inside a Directory before you can delete that Directory. This can be done by manually deleting each file in a Directory or by using 'RD testdirectory /S' (The /S Switch deletes all the files inside the specified Directory).
These are just a few of the many commands that can be used. Type 'Help'
in the 'Command Prompt' and press 'Enter' on the keyboard to view other commands.
The 'Command Prompt' can be used to diagnose and fix problems with your computer.
Diagnose your Network or Internet connection:
The 'Command Prompt' can also be a useful tool in diagnosing your Network or Internet connection. Enter the following in a 'Command Prompt':
This will list your Network and Internet details such as your ip address and Default Gateway.
This will list all the open ports on your computer.
If you are having trouble networking two computers together then find out the ip address of the other computer and ping it to see if your computer can see the other computer.
System File Checker:
This is a very useful command as it will check all your main Windows System Files and will replace any missing or corrupt files. Your computer's Operating System may not be working or booting up correctly because of Malware, or a corrupted or missing Windows System File. You can boot up to a 'Command Prompt' using Safe Mode if necessary and enter 'sfc /scannow' to fix the problem.
Another useful tool is 'chkdsk'
(short for check disk) that checks your disk and verifies the file system integrity of a volume and fixes logical file system errors. Type 'chkdsk C:'
into a Command Prompt and press 'Enter' on your keyboard.