Command Line Interface in Windows 10

This post is lesson 40 of 42 in the subject Computer Hardware

Command Prompt also known as Command Line Interface (CLI). This article will introduce CLI in Windows and how to use Command Prompt to interact computer.

1. MS DOS (MicroSoft Disk Operating System)

MS DOS is an operating system with CLI (Command Line Interface), was introduced in May 1982 by Microsoft Corporation. It is a single-tasking Operating System that allows only a single application to be run at a time. Later Windows Operating Systems are multi-tasking Operating systems.

MS DOS (MicroSoft Disk Operating System)

Later Microsoft Operating Systems became more user-friendly thanks to the Windows interface. But Microsoft still retains the command line interface with the name Command Prompt (CMD).

Command Prompt on Windows 10

To use CMD, press Windows + R key combination, then type cmd.exe.

2. Commands in CLI

2.1. File and directory commands

File used to store information, the operating system distinguishes files by name:

filename = <name>.[extension]

In there:

  • name: required, up to 255 characters, use only alphanumeric characters, _, no spaces.
  • extension: may or may not, be used to determine the file type and maximum of 3 characters.

For example, the following files are valid: BAITAP.TXT, HOSO.DOC, HO_SO.DOC. The following files are invalid: BAI!.TXT, BAI TAP.DOC, HOSO..DOC.

Folder used to store files and subdirectories. On each partition, there is a root directory, denoted by “\”.

Note: Do not name files or folders as: CON, COM1, COM2, PRN, LPT1, LPT2,… because they have the same names as the devices.

Path is the location of the folder or file. The path starts at the root directory (written after the partition name), between folders separated by a “\”. For example: C:\GiangDay\baitap.txt.

There are two types of paths:

  • The absolute path is the path starting from the partition. For example : C:\GiangDay\BaiTap\KTLT
  • A relative path is a path that does not start from the partition. When using relative paths, the current directory must be specified. For example: BaiTap\KTLT in current directory C:\GiangDay.

#help command

If you want to know the syntax of any command, use the help command. For example: help dir

#Command to change current partition

For example, change to partition E, type the command “E:” and then press enter.

Change current partition in CMD

#Command to view the list of files and directories

DIR [path]  /P /S /A

In there:

  • /P (page): view by page
  • /S (sub-directory): view the list of files of the directory including in subdirectories
  • /A (attribute): files with any attribute

#Command to change current directory

CD [path]

#Command to create directory

MD [path]\[directoryname]

You can use MD C:\g\h\t to create 3 nested folders in the C partition.

#View tree-structured directory

TREE [path] /F |MORE

In there, /F (File): including file names in each directory, |MORE: stop each page.

#Remove Directory

RD [path] /S /Q

In there, /S (sub-directory): delete all directories and sub-files, /Q (Quiet): delete without asking.

2.2. Some other basic commands

#Create text file

COPY CON [path]\[filename]

Once created, press F6 or Ctrl-Z to save. If wrong, press Ctrl-C to cancel. For example: Create a file BAITAP.TXT in the HINH folder.


<type the contents of the file here> <F6> (press enter)

#View text file contents

TYPE [path] |MORE

#Rename files

REN [path]\[oldfilename] [newfilename]

For example: Rename the file BAITAP.TXT in the TOAN folder to BT.DOC:


#Move files and directories

MOVE [currentpath] [newfolderpath]

For example: Move file BAITAP.TXT from TOAN folder to LY folder:


#Delete files

DEL [filepath]

For example: Delete files with extension TXT in the HINH folder:


5/5 - (1 vote)
Previous and next lesson in subject<< Steps to install Windows 10 operating systemHow to calculate bandwidth of RAM on mainboard >>
Posted by Vinh Le

Composer at ITLearningCorner.

Leave a Reply

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