CMD: 20 Command Prompt Commands Every Windows User Must Know

Top 20 command prompt (cmd) commands every Windows user should know. Find out more about one of the most useful tools - the command prompt!

The Windows Command Prompt (CMD) is a great tool for programmers and regular Windows users because it offers a ton of commands to control the entire Windows operating system. All those commands can boost your productivity as you don’t have to click through all the graphical user interfaces. Therefore, knowing some of the basic Command Prompt commands is never bad.
If you’re interested, keep on reading!

Most of the commands I am going to mention are also compatible with the Windows PowerShell unless there’s an asterisk (*) in front of the command. (e.g. *color)

Here’s an overview of the commands:

  1. cd
  2. mkdir & rmdir
  3. echo foo > bar.txt
  4. dir
  5. robocopy
  6. move
  7. del
  8. clip
  9. cls
  10. echo
  1. *prompt
  2. *color
  3. help
  4. shutdown
  5. tasklist
  6. taskkill
  7. systeminfo
  8. ping
  9. ipconfig
  10. netstat

To get further information and a list of available parameters of these commands, you can always type
help <command> or <command> /? inside your CMD window.

#1: cd

The first command prompt command of this list is an absolutely basic one. However, you definitely need to know about it!
The cd command is used for changing the directory you are currently working in.

Usually, if you open cmd, the standard working directory is C:\Users\username\.
To navigate to a different directory, you simply need to type: cd [Path]

To navigate to a folder that exists in the current directory, you can just type the name of the folder, not the entire path. (e.g. cd Desktop)

To navigate to the previous folder use cd ..

Command Prompt Commands - cd

#2: mkdir & rmdir

We use mkdir to create a folder and rmdir to remove one.
The desired command is followed by the path the folder should be in or by just the name of the folder.

For example:

  • mkdir Folder1
  • rmdir Folder1
  • mkdir C:\Users\user1\Folder2
  • rmdir C:\Users\user1\Folder2

#3: echo foo > bar.txt

This command is useful for creating a new file with some text in it. If you try to write something in a file that already exists, it’ll get overridden.

This is how you use the command:
echo This is some text > filename.txt

If you want to create an empty file, you can use echo. > filename.txt
Keep in mind that this syntax doesn’t work for PowerShell.

#4: dir

The dir command shows all files and folders of a directory as well as some additional information. You can either specify a path after the command to show the content of a directory you are not currently working in or only type the command to show the contents of the current directory.

cmd Dir comamnd

#5: robocopy

The robocopy command copies one or multiple files of a specified path to another path.

The syntax for this command looks like this:
robocopy <source path> <destination path>  [file(type)]

If you don’t specify a file or file type, robocopy will copy the whole content from the source path.
To copy multiple files or specific file types you can use an asterisk (*). It basically means “everything”.
For example: robocopy C:\Users\user1 C:\Users\user2 *.txt

There are a ton of additional options for this command. You can have a look at all of them here.

#6: move

Of course, there also is a command for moving files. The syntax for this command is similar to robocopy and very simple:
move <source file path> <destination path>

For example:
move C:\Users\user1\file1.txt C:\Users\user2\

If you don’t specify a filename for the destination, it uses the original filename. Otherwise, the file you want to copy will be renamed to the name you specified in the destination path.

#7: del

To delete a file using cmd, you just need the del command. It is used like this:
del <file path>

You can either specify a whole path to the file or just type the name of the file if it is inside the current working directory.

Be careful not to confuse this command with rmdir, as rmdir deletes entire folders, not files!

#8: clip

The clip command/attribute copies the output of any desired command. Compared to other commands from this list, the clip command isn’t really a command. In reality, it is an additional instruction that comes after a different command.

So, to copy a command’s output, simply put | clip after it.

For example:
echo this is a test | clip

This command copies “this is a test” to the clipboard, as it is the output of the echo command.

#9: cls

The cls command is a pretty simple one. Its only task is to clear the console (CMD/PowerShell) window.
This command doesn’t take any additional arguments.

#10: echo

Echo is used to display text inside the console window (CMD/PowerShell).
It’s rather simple. Just write the text you want to print out after the echo command.

For example:

cmd echo command

Besides printing out text, the echo command is also used for other features like creating files, etc.
However, printing text to the console is one of its main use cases.

#11: *prompt

A very useful one this the prompt command. It changes the prompt text in cmd.

The standard prompt is just the current path. (e.g. C:\Users>)

The syntax for the prompt command looks like this:
prompt <new prompt text>

You can either select a basic text as your prompt or use different parameters to display symbols and information.
You can find information about the different parameters and symbols in the official documentation of Microsoft or by typing help prompt inside CMD.

cmd prompt command

#12: *color

With the color command, you can change the background color and text color of your console window.

For example, the command color a makes the text of your console green.

Here is a list of every available color:

ParameterColorParameterColor
0Black8Gray
1Blue9Light Green
2GreenALight Blue
3AquaBLight Aqua
4RedCLight Red
5PurpleDLight Purple
6YellowELight Yellow
7WhiteFBright White

 

You are allowed to give two parameters to the command.
The first one is the background color, and the second one is the text color.
If you use only one parameter, only the text color will change, and the background color resets to black.

color command

#13: help

The help command provides you with useful information about the most commonly used commands.
To use it, just type help into CMD or PowerShell.

If you want to get help to a specific command, you can simply write the commands keyword behind the help keyword.

For example:

Help command

#14: shutdown

The shutdown command can be used to shut down, restart, and hibernate the computer or to log off a user.

There are a lot of additional parameters to this command. Additionally, you can specify a reason for the shutdown. To get a detailed description of all the parameters, enter shutdown without any parameters.
Nevertheless, here’s a list of the most important parameters.

To shut down immediately, use:
shutdown -p

To shut down with a warning and delay, use:
shutdown -s

To restart, use:
shutdown -r

To abort the shutdown, use:
shutdown -a

To log the current user off, use:
shutdown -l

#15: tasklist

Tasklist lists all tasks that are currently running as well as some information about them.

Again, there are multiple arguments you can pass to this command. As always, you can display all possible parameters with help tasklist.

If you do not specify any parameters, the command will list all processes with their corresponding PID numbers, session names, and their memory usage.

#16: taskkill

With taskkill, you can terminate processes by their PID name or process name.

This command requires some parameters:

  • To kill a task by its PID: taskkill /PID <PID>
  • To kill a task by its process name: taskkill /IM <name>

Additionally, you can choose to terminate every child process a process started with the /T option.

#17: systeminfo

Systeminfo displays a ton of information about your computer.

For example, the hostname, the OS name & version, the system type, etc.

I suggest trying this command on your own to see what information it shows.

#18: ping

You can use the ping command to check whether a specified server is up. Additionally, the ping command returns information like the server’s response time.

To force IPv4 addresses, use the -4 argument. For IPv6 use -6.

Again, there are a lot of additional parameters you can use.

#19: ipconfig

The ipconfig command displays information about the network configuration of your network adapters.

For example, it shows your IP address, your MAC address, and your default gateway.

If you want even more detailed information, you can use ipconfig /all.

#20: netstat

Netstat shows you every active connection of your computer.

If you don’t pass any arguments to the command, it will show the protocol, the local address, the foreign address, and the connection state of each connection. 

Thanks for reading!

Share this article

Leave a Reply

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