How To Use Command Prompt


The Command Prompt is going to make you feel a little bit like a hacker. It allows you to access and run files from your computer from one central place. Please make sure when entering these commands into the Command Prompt that you follow exactly what is written or you will run into issues. Refer back to this page whenever needed. Eventually utilizing the Command Prompt will become second nature to you. We have not currently written instructions for other operating systems. Our main goal from this tutorial is to simply introduce you to the Command Prompt and give you a taste of what it offers. We encourage you to investigate for yourself other functions of the Command Prompt. At the bottom of this article we have compiled a list of resources for you to explore beyond the limits of this tutorial.

Our Guide

How To Change and Navigate Through Folders:

“cd” is going to be your new best friend. It stands for “change directory” which changes the folder in your computer that you are accessing. You enter “cd NameofDirectory” into the Command Prompt and then hit Enter. This allows you to navigate through your computer files the same way you would if you were using your everyday File Explorer. Once you have changed your directory, that new directory should pop up next C:\Users\YourUsername>NameofDirectory. If this gives you an error message, you can use another command to check that you are searching for the correct file name.

“dir” will list all of the files in your computer that are part of the directory that you are currently in. Make sure that you are searching for the correct name of the folder/directory or file that you are trying to navigate to. The actual name of the desired file/folder should be listed in the directory you just pulled up.

If you are using Mac OS or Linux, the "dir" command is "ls" instead.

“mkdir” will make a directory. Using “mkdir” is similar to creating a new folder on your desktop. You can type “cd NameofDirectory” to move into your new directory.

“cd ..” allows you to go back to the previous directory. Remember your syntax here! Syntax is the set of rules that define what is correctly structured language. If you use incorrect syntax, the computer will probably not understand what you are trying to tell it to do. This is for when you want to navigate out of the directory you are currently inside of.

Running Files

Running your file allows you to see your program in action. In order to run a file on your computer (remember this for when you want to do this later), you must navigate to the proper folder and then type the language that you are using and the name of the file. If I wanted to run a program written in Python that was called MyProgram, I would type in the Command Prompt “python MyProgram.py” and press Enter. This will run whatever code you have written in that file.

Any errors you receive can be usually be easily remedied by simply searching the error in Google. Stack Overflow is a great resource that you will come across as a top search result when you search for solutions to your error messages. It is like Yahoo Answers for coders.

Some extra resources for using the Command Prompt can be found here and here.