Using Command Prompt on Windows 10

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

1. Lesson objectives

Teach students to understand basic commands when interacting with the operating system through Command Prompt.

Students can manipulate commands on files/directories.

2. Introduction to the Command Prompt

Today, the operating systems on most personal computers support a Graphic User Interface (GUI) program. Thereby, operations on the computer can be performed simply.

In addition, we can perform most of the tasks on the computer with Command Line Interface or CLI. The command line interface in Windows OS is called Command Prompt.

3. Tutorial to use Command Prompt

To use CMD, press Windows + R key combination -> Run dialog box appears -> enter cmd -> click OK.

How to launch CMD
How to launch CMD

The Command Prompt window displays.

Command Prompt interface
Command Prompt interface

Some basic commands in CMD:

1DRIVE:Change 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 directory 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.
[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. Xem/thay đổi thuộc tính tập tin/thư mục +: 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 user PowerShell on Windows

PowerShell is a command line interface program that is gradually replacing Command Prompt on Windows. PowerShell will work on the .NET environment and the .NET Framework includes commands and programming languages.

In parallel with PowerShell, Windows also developed Windows Power Shell ISE. ISE (Integrated Scripting Environment) includes a graphical user interface for programming and integrates various tools that support manipulation with Power Shell.

Windows PowerShell has been developed by Microsoft for quite some time. However, an updated version with many improved features has been introduced since Windows 8.1 and Windows Server 2012.

To start  PowerShell on Windows, press the Windows + R key combination, enter “powershell” to open the Windows PowerShell interface.

How to start PowerShell
How to start PowerShell

Windows PowerShell program interface.

PowerShell interface
PowerShell interface

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, knowing that when entering Command Prompt, we 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 CentOS operating system on virtual machineIn-class test: install OS for Desktop >>
Posted by Vinh Le

Composer at ITLearningCorner.

Leave a Reply

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