A gentle introduction to the Windows Command Prompt

Why would anyone use the text based command prompt when clicking and dragging windows is so much easier?

This is a fair question.  Perhaps you’ve seen your boss fiddling with that obscure black screen that resembles the matrix or maybe you’ve always wanted to use the command prompt but you’ve been afraid that you might irrevocably delete a crucial file.  Whatever your motivation is for learning, I want to commend you for taking this step to get acquainted with it.

It’s not easy to approach something you don’t understand.  It takes guts and I’m elated that you’ve made the decision to conquer your fear.

In this guide I’m going to introduce you just the basic basics.  I’ll leave the advanced stuff for another day. The purpose of this guide is just to get you in the command prompt typing commands.  I want you to see how powerful it is and that there’s really nothing to be afraid of.

First I need to share my story about how I got introduced to this nimble tool…

I love the command prompt but it wasn’t always this way.

In the early 2000’s when my IT career was still budding, I remember watching my boss bang out commands so fast that it made me feel like he was more machine than man.  His name was Bill Screws (I ‘m not kidding) and he worked in the Office of Computing Services at my school.  He was a short, skinny shy guy who spoke in a whispered voice that resembled Jack Bauer from 24.

By the way, if anyone can pull off Jack Bauer’s inimitable voice I promise it will give them instant credibility.

The fact that Mr Screws rarely spoke but could type out commands with confidence made me think he was brilliant.  As a college sophomore, I remember being transfixed as I watched him type obscure command after obscure command into the DOS prompt.

His fingers tapped the keys with a quick grace and he always completed his commands with gusto.  He never lingered – he just opened the command window, did his digital alchemy and closed the screen. And then in a matter of seconds something that was broken magically worked again.

I would just sit there flummoxed wondering how he did that.

I remember wishing I could do the same thing, or at least understand a little bit about what he was doing. But I was too afraid to ask questions.  After all I was working in the Office of Computing Services so didn’t my boss already expect me to know this stuff?

Today I’m undaunted by the command prompt but I share that story so you can see that I’m an ordinary person just like you but since I’ve been using this thing for over a decade I’m very comfortable with it.

But enough about me – I just want to accomplish two things today:

  1. Provide a hands on introduction to the command prompt
  2. Share a few of my favorite commands

If you’ve already used the command prompt stop reading now and close the page because this stuff is so basic it’ll piss you off.  Otherwise, keep reading and watch me help you tackle your fears.

Say hi to the night sky

If the command prompt had a starry background I’m sure it would be more appealing; however, it’s not so friendly.

The best way to understand the command prompt is to open it up and follow along while you read.

If you’re fortunate enough to own dual monitors move fixedByVonnie over to one screen and we’ll open the command prompt together on the other screen.  If that’s not possible you can easily snap this webpage to one side of the screen by clicking the title bar of your browser and pressing the Windows Key + right arrow. Every time you press the right arrow, Windows will try to position itself on one half of your screen.

But this only works in Windows 7 and newer so if you’re running Vista you might have to manually shuffle your windows around so you can read this page and type the commands.

In any case, let me start by telling you exactly why we have a command prompt and what it’s used for.

Why the command prompt?

The command prompt is just a program that interprets text commands that you enter in the window.

In the antediluvian days of computing (or should I say: the dark ages of computing when Windows 98 was the latest fad) people used a enigmatic little program called MS-DOS.

Perhaps you’re old enough to remember this archaic program.  It was introduced in the early 80’s and once upon a time it was THE operating system of the PC.  The developers carried it through several iterations and it was eventually replaced by the graphical user interface that dazzled the world in Windows 95.

Today, ordinary users don’t deal with the command prompt because they honestly don’t need it.  Almost anything you could ever want your computer to do can be accomplished with a few clicks; however, you’re not an ordinary user.  Clearly, you want more from your computer so let’s do this.

Is the command prompt MS-DOS?

On your computer, go ahead and click the Windows icon in the lower left corner of the screen and type cmd.exe.  If you’re using Windows 8 or 8.1 you can just type the Windows Key + x + c to open the command window.

This window looks very similar to its MS-DOS predecessor of old; however, it’s technically not a MS-DOS prompt.  Although some people, including competent tech guys, erroneously refer to the Windows command prompt as MS-DOS, the two are actually disparate things.  The command prompt isn’t MS-DOS.

Let’s get comfortable

So let’s observe the command prompt window that’s staring you in the face.  Repeat this with as much confidence, strength and conviction that you can:

I will conquer you

Okay, now that we got that out of the way let’s break down the screen a little bit.

Windows 8.1 Command Prompt Home Screen

The important thing is the line with the blinking cursor.  You’re screen may look a little different (especially that last line but the point is that you’re sitting at a blinking cursor)

By default, the command prompt opens in your user directory.  This is simply the directory that matches your computer account name.

The screen shows C:\Users\vhudson> because I’m in a folder called vhudson in a folder called Users on a hard drive called C:  The command prompt is just showing me the “trail” to the current directory so I know where I am the operating system.

The blinking cursor means it’s waiting for you to give it something to do.

But before we start banging out instructions we need to know a little bit about the commands.

Command chaos

Most commands have options to filter the results.  These options are implemented by typing the command, entering a space and then typing a forward slash and the option name. (The forward slash is usually on the question mark key.  I get this confused so I remember it by thinking of it like a tree bending in the wind.  If it’s about to fall forward, to the right, then it’s a forward slash)

For example, type dir into the command prompt window and press enter.

Windows 8.1 command prompt dir

Depending on the directory you’re in you’ll see a bunch of text fly by the screen.

Besides sounding like Homer Simpson when he does something stupid, dir is short for Directory and it just lists all the files and folders in the current folder.

The output is segmented into five columns:

  • Starting from the far left, we have the date when the file or folder was modified.
  • The next column shows the exact time of modification.
  • Next we have the resource type.  If it doesn’t say <DIR> it’s a file.
  • The fourth column is mostly empty but for files it shows the size in bytes.
  • The last column prints the name of the asset

This is a lot of information but we can easily change what shows up with a few command options.

Type this in the command prompt:

dir /B

Windows 8.1 command prompt dir slash b

We just used the bare format option to only display the files and folders without all that extra stuff.


So how did I know about /B?

Glad you asked! I actually didn’t know about it before I wrote this tutorial but discovered it with a very useful command option: /?

If you append the slash question mark to almost any command you’ll see a list of relevant options. (these are also called command arguments)  I quickly sifted through the list and noticed /B would give me exactly what I wanted.

Now that the screen is getting a little messy let’s wipe it clean and start fresh.

Type:

cls

So far we haven’t done anything very exciting but I hope you’re starting to loosen up a little.  Take about 3 minutes to go through the command options for dir and type off a few commands to see what happens.

One of my favorites is dir | more

Try it out!  The only way you’re gonna get this stuff is if you explore on your own.  You can do this.


Okay let’s move on.

I know we didn’t do much in this short lesson but my eyes are starting to hurt and I’m getting tired of typing. I really can’t give you my best when I’m feeling lazy so I think it’s a good idea that I stop this article here and pick it up with a more advanced tutorial later.

If I were to give you homework I would say do the following things:

Read my articles on the command prompt fun and start exploring the web for tutorials.

If this guide helped you ease over your command prompt fears, please share your liberating experience in the comments below!  Also, if you want to join my team and get exclusive content by me, drop your name in the signup box in the right rail to become a fixedByVonnie member.

Thanks again!

About

Connect with Vonnie on Twitter

Posted in Windows, Windows 7, Windows 8, Windows 8.1, Windows Vista Tagged with: ,