Most Windows users don’t know what the Command Prompt is or how to use it. This is a beginners guide to using the Command Prompt.
What is the Command Prompt? The Command Prompt is a native Windows program that lets you execute commands without using a GUI. You can accomplish pretty much every task you can do using Windows and the mouse from within the Command Prompt. The Command Prompt gets its roots (arguably) from a combination of MS-DOS and UNIX. Consider it “Windows without the windows. ” I will provide you with a beginners tutorial of some simple commands to familiarize you with the Command Prompt.
The first step is to actually open the Command Prompt. You can do this
by going to Start >> All Programs >> Accessories >>
Command Prompt. You should get a screen that resembles mine below:
You should see a blinking cursor after a line that says C:\Documents and Settings\username. This is used to identify what directory you are currently in. This also brings us to our first three commands cd, dir, and .. (two periods). Let’s start with dir — “dir” stands for directory. Type dir into the command prompt to see a listing of the directories and files located in your “username” directory.
After you type in dir you will see a listing of
several folders including Desktop, Favorites and My Documents. “CD”
stands for change directory. So in order to change to our “My
Documents” folder we need to type cd My Documents, give
it a try. You will now notice that your path has changed to
C:\Documents and Settings\username\My Documents. To see a list of all
the files in your My Documents directory type dir. If you want to move back into your username folder use the “back” command. You can move back by typing cd .. See the image below:
That’s a good introduction, but lets actually go over some useful commands: copy, del, mkdir, rmdir, ren. “CP” stands for copy and it can be used to copy individual files from one location to another. To copy a file, type copy filename destination. So if you had a file named test.txt in your My Documents folder and you wanted to copy it to the Desktop you would type copy test.txt ../Desktop
The del command stands for delete. So to delete the test.txt file from your desktop type cd ../Desktop and then type del test.txt
“mkdir” stands for make directory. To make a new folder type mkdir foldername
“rmdir” stands for remove directory. To remove a folder and its contents, type rmdir /s foldername
“ren” stands for rename. To rename a file type ren oldfilename newfilename
Let’s move on to a more difficult task. Let’s copy our My Videos folder
from My Documents to the Desktop. To do this, navigate to your username
directory by typing cd .. until you get there. Now type cd My Documents to get into the My Documents directory. To copy the My Videos directory to the Desktop you need to type xcopy “My Videos” “../Desktop/My Videos” /s /i
Here’s a summary of what you can now do using the command prompt:
cd change directories
dir see a list of all the files in one directory
copy copy a file from one location to another (don’t forget to include the file extension)
del delete a file (don’t forget to include the file extension)
mkdir make a new folder
rmdir remove a directory and its’ contents
ren rename a file
xcopy /s /i copy a directory and its contents from one location to another
NOTE: To see a list of many commands, just type help into the command prompt. To see a detailed list of all related commands type command/? so to see all the details of xcopy type xcopy/? If you would like to run an executable like Mozilla Firefox navigate to the directory containing the executable and simply type it in. So type: C:/Program Files/Mozilla Firefox/firefox.exeIf you would like to learn more about the command prompt here is the documentation from Microsoft. What other commands do you think are useful for beginners?
From
No comments:
Post a Comment