The Basics of Command Prompt

The command prompt is a tool on Windows operating systems that allows you to run various operations that you can and cannot run without using the command prompt. For example, you are able to create files and folders without using the command prompt but you can achieve the same using the command prompt. You can also find out information about your computer, such as its name, domain, IP address, default gateway, etc using the command prompt. The command prompt is a carryover from back in the day when the Windows operating system was just a terminal with no graphical user interface.

You can open the command prompt in Windows by searching for “command prompt” or “cmd” in the start menu, or you can open the run dialog (by holding the CTRL key and pressing the R key) typing ‘cmd’ and pressing enter. Once the command prompt is open you can run scripts and commands directly in it. The language used in the command prompt is called Batch, you can also create batch files (files with a ‘.bat’ extension) and execute them.

The ‘echo’ command can be used to print a statement to the command prompt, anything that follows the ‘echo’ command will be printed to the terminal. If you open command prompt and type ‘echo Hello World’ and press enter then the words “Hello World” will be printed to a new line within the terminal.

echo Hello World

You might notice a directory path when you open the command prompt. The command prompt will execute the command within a certain directory or folder on the operating system. You can change the directory you are currently within the command prompt by using the ‘cd’ command or change directory command. You can either type an absolute path to the directory you want to change to or a relative directory path (such as ‘cd ../myDocuments’).

cd C:\Users

Using the ‘cd’ command on its own, without supplying a directory or path, will print the current directory path that the command prompt is within. If you are unsure what directory you are in, or want to run a process on the current path, then you can use the ‘cd’ command on its own to get the full path to the current directory.


Using just the terminal you cannot see the files within the current directory, unlike when using the traditional Windows file explorer. The ‘dir’ command will list all the files and folders that are within the current directory. This can allow you to see what files are in the directory, see which directories are available to navigate into, or just to verify that a certain file exists in the current path.


The ‘mkdir’ command can be used to make a directory within the current directory using the command prompt. The below example will create a directory called ‘my_new_dir’ in whatever directory you are currently inside within the command prompt.

mkdir my_new_dir

You can also create files using the echo command and a ‘>’ less-than operator. This will echo the word “hello” into a new file called ‘test.txt’. If the ‘test.txt’ file does not exist it will be created and its contents will be the word ‘hello’.

echo hello > test.txt

The ‘type’ command can be used to read the contents of a file without leaving the command prompt terminal. The below example will print the contents of the ‘test.txt’ file to the command prompt.

type test.txt

The ‘del’ command can be used to delete files when using the command prompt. The below example will delete the ‘test.txt’ file if it exists in the current directory.

del test.txt

The examples shown in this post are just the beginning of command prompt and how to use it, there are a lot of different things you can do with command prompt. Sometimes you can only use command prompt so know the basics can be useful. For example, if you use SSH (Secure Shell) to connect to a remote computer will only allow you to use a terminal, which could be a command prompt or a bash terminal (the Linux/Mac version of the command prompt).

Leave a Reply