Using Command Prompt on Windows 10

This post is lesson 15 of 16 in the subject Computer Hardware Practice

1. Lesson objectives

This lesson will instruct students on how to use basic commands in Command Prompt on Windows 10.

2. Introduction to the Command Prompt

Nowadays, Graphic User Interface (GUI) programs are supported by most personal computer operating systems, making computer operations simpler. Additionally, it is possible to perform most computer tasks using Command Line Interface (CLI). In Windows OS, the command line interface is called Command Prompt.

3. Guide for Using Command Prompt

To use CMD, press the Windows + R key combination. This will open the Run dialog box. Enter cmd in the box and then click OK.

How to launch CMD
How to launch CMD

The Command Prompt window will appear.

Command Prompt interface
Command Prompt interface

Here are some basic commands you can use in CMD:

#CommandFunction
1DRIVE: (For example, E:)Change the current drive
2DIR [drive:][path][filename] /P /W /S /ADisplays a list of files and subdirectories in a directory.
/P: Pauses after each screenful of information.
/W: Uses wide list format.
/S: Displays files in specified directories and all subdirectories.
/A: Displays files with specified attributes. (/AH: Hidden files; /AR: Read-only files; /AS: System files; /AA: Files ready for archiving)
3CD [/D] [drive:][path] CD [..]Displays the name of or changes the current directory. CD.. specifies that you want to change to the parent directory.
CD\ switch back to the root directory
4MKDIR [drive:]path MD [drive:]pathCreates a directory.
5RENAME [drive:][path]filename1 filename2. REN [drive:][path]filename1 filename2.Renames a file or files.
6TREE [drive:][path] [/F] [/A]Graphically displays the folder structure of a drive or path.
/F: Display the names of the files in each folder.
/A: Use ASCII instead of extended characters.
7RD [/S] [/Q] [drive:]pathRemoves (deletes) a directory.
/S: Removes all directories and files in the specified directory in addition to the directory itself.  Used to remove a directory tree.
/Q: Quiet mode, do not ask if ok to remove a directory tree with /S
8COPY CON [path]\filenameCreate a new file F6 or Ctrl + Z: save new file
Ctrl + C: cancel file creation
9TYPE [drive:][path]filenameDisplays the contents of a text file or files.
10REN [drive:][path]filename1 filename2Renames a file or files.
11COPY
[filename_01] + [filename_02] [new_filename]
Merge contents of files
12COPY [source_path] [destination_path]Copy files
13MOVE [drive:][path]filename1[,…] destinationMoves files and renames files and directories.
14DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] namesDeletes one or more files.
15ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [+O | -O] [+I | -I] [+X | -X] [+P | -P] [+U | -U] [drive:][path][filename] [/S [/D]] [/L]Displays or changes file attributes.
+: Sets an attribute.
-: Clears an attribute.
A: Archive file attribute, read-only file attribute.
H: Hidden file attribute
S: System file attribute.
16DATE [/T | date]Displays or sets the date.
17TIME [/T | time]Displays or sets the system time.
18CLSClear the screen.
19FORMAT [DRIVE:]Formats a disk for use with Windows.
20LABEL [DRIVE:] [LABEL]Creates, changes, or deletes the volume label of a disk.
21VOL [DRIVE:]Displays the disk volume label and serial number, if they exist.
22SHUTDOWN -s -t [a] (a is second)Turn off the computer

4. How to use PowerShell on Windows

PowerShell is a command line interface program that’s gradually replacing Command Prompt on Windows. It works on the .NET environment, and the .NET Framework includes commands and programming languages.

PowerShell has a parallel development with its Integrated Scripting Environment (ISE) which includes a graphical user interface and various tools for manipulating PowerShell. Windows has been developing PowerShell for a considerable amount of time and its updated version with many improved features has been introduced since Windows 8.1 and Windows Server 2012.

To open the Windows PowerShell interface on Windows, press the Windows + R key combination, and type “powershell” in the command prompt.

How to start PowerShell
How to start PowerShell

The program interface for Windows PowerShell.

PowerShell interface
PowerShell interface

For commands on PowerShell, students can refer here.

5. Requirement of practice

Let’s create a directory tree in the image below:

An exercise using Command Prompt
An exercise using Command Prompt

Note: Do not use the “\” in Command Prompt, and when you enter Command Prompt, you will see:

Default path on CMD
Default path on CMD

a. Use the command to create 2 files GiaoTrinh.txt and BaiTap.txt with the following content in the directory C:\QLHVIEN\TINHOC. The contents of the GiaoTrinh.txt file are as follows: “Textbook of TH-PCMT for IT students“. The content of the BaiTap.txt file is as follows: “Manipulating command line commands on Windows“.

b. Merge GiaoTrinh.txt and BaiTap.txt to NoiDung.txt.

c. Move all newly created files to C:\QLHVIEN\TINHOC\CANBAN.

d. Rename the file NoiDung.txt to Content.doc.

e. Create folder VP1, VP2 in folder VANPHONG.

f. Delete the VP1 folder.

g. Delete the VANPHONG folder.

5/5 - (1 vote)
Previous and next lesson in subject<< Install the CentOS operating system on the virtual machineIn-class exam: install OS and use Command Prompt >>

Leave a Reply

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