A Beginner’s Guide To The Windows Command Line

Tina Sieber 17-10-2009

This is not another post about smilies. This article deals with the Windows command line.


The command line lets you communicate directly with your computer and instruct it to perform various tasks. For this you have to use specific commands. The commands are not necessarily intuitive, so they have to be learned, just like words in a language. Fortunately, there are graphical user interfaces (GUIs) replacing most procedures that formerly required using the command line.

However, sometimes using the command line is quicker or even the only way to access certain information. Thus knowing how to use the command line can be extremely valuable. And that’s where this Windows command guide comes in.

To access the Windows command line in XP, click > START > Run, type cmd into the > Open: field, and click > OK.

windows command guide

Alternatively, you can go through > Start > All Programs > Accessories and select > command prompt.


This launches cmd.exe, a window that reminds us of the old days in computer history: pure white text on a uniform black background. Despite its resemblance to a DOS windows, cmd.exe merely is a command line interpreter merely similar to DOS.

guide windows commands

Now that you have successfully accessed the command prompt, what is there to do here?

To operate at command prompt level, you need to know some commands. Let me give you some basics to play with.



First let me say that there is intrinsic help in the command prompt. If you’re not sure whether a certain command really exists or what it does or what switches there are to it, type the command followed by a /? and you shall be enlightened.


Switches are optional extensions to a command, which change the command’s behavior. We actually saw an example of a switch in the previous section. /? is a switch to any command, explaining its function rather than executing it in any way.

Note that you can add several switches to each command, but always leave a space between the command and each switch.

Now let’s get on with serious commands.



The dir command lists the contents of the current directory.

There are some useful switches to it. For example dir /d (/d being the switch) will list the directory contents in up to three columns. Alternatively, you can use dir /w, which will sort the contents differently. With dir /p the information doesn’t scroll, but pauses at the end of the screen, until you hit a random key for the next screen full of data.

windows command guide


To change directories, use the cd command.


Pick a directory seen in the previous dir listing. Directories are indicated by <DIR> in the directory listing. For example type cd desktop and you will switch into the Desktop directory. Type cd.. to return to the previous directory. To go directly to a specific directory, rather than haggling your way through each single one, type in the entire path. Let’s say you went back to C:\> and want to return to the Desktop directory. Simply type cd documents and settings\administrator\desktop.

Note that switching between drives doesn’t require the cd command. Simply type in the respective drive letter and a colon, e.g. d: to switch.


This one is used to make a directory, i.e. create a new directory. Type mkdir name to create a directory called name.


To remove a directory, use this command. So that would be rmdir name to remove a directory called name. Only empty directories can be removed.

You can of course create and delete directories located in any other directory, you just have to specify the respective path in your command, starting from where you are.

For example mkdir documents and settings\administrator\test when you’re in C:\ or mkdir administrator\test if you’re already in the documents and settings directory.


This is the command to delete files. It works similar to the mkdir and rmdir commands. So you type del example.exe to delete the file example.exe in your directory. If you’re not already in the right directory, you add the respective path.

This was a short list of commands to make you familiar with the command line environment.

command prompt

We will now look at some very helpful commands for tasks that can not easily be completed by any other means. For all of them you can use the /? switch, to find out what all you can do with these commands.


For a list of all drivers installed on your system, driverquery is the quickest solution.


Ping must be the most popular command line prompt. It’s used to check an IP address and see whether the respective computer is online or responding, i.e. whether network communication between your and that computer is possible.


Here you can reveal network data of your own computer, such as the name of your computer in the network, your IP address or your MAC address.


The command to retrieve extensive information about your system, including Windows serial number, computer model, and available RAM.

This Windows command guide can merely touch on the surface of what the command line can do. For more extensive information, please refer to The Command Line in Windows and PCStats’ WindowsXP Command Prompt Guide.

If you got hooked, you might want to check out the following MakeUseOf articles dealing with the command line. Varun wrote about 10 Windows Command Line Tips You Should Check Out 10 Windows Command Line Tips You Should Check Out While the Windows command line is not considered as powerful as a Linux's, here are some Windows command line tips and tricks not everyone might know about. Read More and he introduced Nircmd – A Power Packed Command Line Tool Nircmd - A Power Packed Command Line Tool Read More . Mark explained how to Change the Windows User Password How to Change the Windows Password via Command Line With Net User Use the Windows command line "net user" command to change your password on the fly. Our article explains this method in detail. Read More via Command Line.

What command do you find most useful?

Related topics: Command Prompt, MS-DOS.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Vico
    November 15, 2016 at 12:45 pm

    Hi Tina. As I was reading the article I found many useful things, thank you very much; but then, I started to read the comments and got lost with everybody being so skillful in this. I have to confess I am very new and very ignorant about command, but now I have to learn how to use them since most of the information of my work (I am a researcher and I started to do RNASeq) and the information in articles and books are based on commands. I will keep going through your articles and practice, but as somebody said before, keep them coming please, they are very helpful for people like me.

    • Tina Sieber
      November 15, 2016 at 1:09 pm

      Thank you for your feedback, Vico! Glad I could help you progress on your path to learning about the command line. All the best for your research!

  2. David Bruner
    October 16, 2016 at 11:43 am

    I'm glad just to be introduced into knowing some....d

  3. MSFT guru
    September 12, 2016 at 2:51 am

    There are some errors in this post. First cd.. will not work, you have to have a space between the cd command and the dots like "cd ..", without the quotes of course. However, you do have to use quotes when you are entering a path that contains spaces. So instead of

    cd documents and settings\administrator\desktop

    You must type

    cd "documents and settings\administrator\desktop"

    The same applies to mkdir and rmdir commands.

    If you create your shell using a script, such as from the run dialog using "cmd /k shell.cmd", again sans quotes, then in that script file you can create macros aliasing cd.. to cd .. this is something I have done because it's so common that I forget the space. Use the doskey command to create macros.


    June 9, 2016 at 5:56 pm

    thank u

  5. Harsh Rohila
    January 15, 2016 at 6:22 am

    nice basics for command prompt

  6. Nivedan Nayan
    December 26, 2015 at 8:29 am

    Highly useful.... Thanks..

  7. Anonymous
    September 3, 2015 at 10:52 pm

    This was so useful for me, and really simplified for me to understand as I begin linux and computer programming. Please keep these articles coming!! Love them! Thank you!!!

  8. Anonymous
    July 31, 2015 at 3:00 am

    i want to know that how to open cmd in switch user

  9. suifengtec
    April 29, 2015 at 11:08 am

    Cmder is more powerful than the default command line tool of Windows!

  10. thrifty kapila
    February 19, 2015 at 6:18 am

    dear tina , is it helpful to prefer cmd than to any other or is there any other good software ?

    tell me can we make C programs in the cmd or not ?

    • Tina Sieber
      February 20, 2015 at 9:16 am

      I don't understand your question.

      Are you asking whether there's an easier tool to access the same functions? Maybe one with a more user-friendly GUI? Some functions can be accessed in other ways, but I can't think of a cmd line replacement tool; that simply doesn't make sense.

      Are you asking whether you can program in C in t he cmd line?

  11. markus
    October 26, 2009 at 8:35 am

    thanks for this of your information cause it will really save me the problem of command line

  12. pceasies
    October 18, 2009 at 12:39 pm

    Also, if you want to run a program that is going to ask you something, you can type "program.exe | echo thing" And if the program prompts, it will automatically answer "thing"

    Also, "program.exe | find "thing"" and it will find "thing" in the program output and display that line. Good to use with systeminfo and dir to find a certain line.

    • Tina
      October 18, 2009 at 1:40 pm

      Many thanks for the input!

    • ABitOfBetterButter
      October 26, 2009 at 11:18 am

      Don't you mean "echo thing | program.exe" ? You're piping that *input* to program.exe, not the program's *output* to echo.

  13. JBu92
    October 17, 2009 at 8:38 pm

    if you want to save a bit'o'time you can use /k [command here] after typing cmd in the run box, it will keep a persistent window of cmd after running [command here]
    useful for opening in a specified directory i.e. cmd /k cd c:/python26

    • Tina
      October 18, 2009 at 3:48 am

      In other words, to run a command from the run box, rather than to first open the command window, you have to first type cmd /k followed by the command.

      Thank you JBu!

  14. Sotiris Z
    October 17, 2009 at 6:19 pm

    Thank you,really useful!

  15. Mike
    October 17, 2009 at 5:07 pm

    Very helpful!