Basic Command Line in Windows

A quick and useful tool

2020-01-04 Mike Lyou


This article briefly introduced the common usage of command line.

During the building of my blog, I encountered the command line. Though solved the tasks at that time, I know nearly nothing about the command line. So today I am going to figure out what the basic command line can do for me.

Due to huge workload and little importance, not grapghs to illustrate.

Introduction to command line

What is the command line?

The command line, appears as cmd, is a handful tool that let you communicate directly with computer. It can perform some tasks much quicker than normal ways, and sometimes is the only way, like when you launch the jekyll serve. And it is cool.

It looks like DOS, but has little to do with DOS.

Access the command line

There are two ways to access the command line.

  • Method 1. Press Win + R to open Run → type cmd and Enter.

  • Method 2. Press Win to open Start menu → type cmd and click Command Prompt (here you can run as Admin).

And then you should see the window of cmd.exe.

Now we have launched the cmd.exe, what can we do next?

Below I will introduce several things we can do with command lines.

Common Commands about directories and files

Now we have launched the cmd.exe, what can we do next?

Below I will introduce several things we can do with command lines.


By default, the cmd.exe is at directory of C:\WINDOWS\system32 or C:\Users\Username. You can see it once you open the cmd.exe.

If we want to search files or run programs in another directory, we have to change the directory to there.

Use cd NEW_PATH to change directory to NEW_PATH.

If NEW_PATH is at a drive other than C:, assuming it is E:, we need to change drive before that.

E:              # change drive
cd E:\NEW_PATH  # change directory

You can see the directory changes at the beginning of the new lines that pops up.


List all the files and sub-directories in current directory.


Use mkdir DIRNAME to create a new directory named DIRNAME


Use rmdir DIRNAME to remove directory named DIRNAME.

Only empty directory can be removed. Trying to remove a nonempty directory will generate an error message.


Use del FILENAME.extension to delete file named FILENAME.extension.


If you don’t know what command is available, type help to see all commands.

Common commands about Windows systems


Use ping command to check the responding time between an IP and your computer.

ping  # IP of

You can check the IP of an website by this way as well.


Use ipconfig to reveal many network data of your computer.


Use systeminfo to see information about your Windows system.


I don’t know where I can use these…

shutdown -s         # system will shutdown in 1 minute
shutdown -s -t 3600 # system will shutdown in 3600 seconds
shutdown -a         # cancel shutdown command

Save commands as batch file

Save frequently used command lines as batch file can free ourselves from typing the same words again and again. To do this, we just need to:

  1. Create a .txt file.
  2. Write some commands and save.
  3. Change the extension to .bat.

Now we have created an batch file. Double-click it and it will run as command lines in the directory of this batch file.

For Example, I created a batch file with content as

cd E:\GitHub\
jekyll serve

And next time when I want to launch the jekyll serve, I can simply double-click this batch file, rather than open the command line and type those long words.


This article is Mike Lyou’s original work and may not be reproduced without permission.

Author: Mike Lyou
Liscense: This work is licensed under a CC BY-NC 4.0 International License.