Microsoft DOS CMD Terminal Tutorial

22 Sep 2024

Microsoft DOS CMD Terminal Tutorial

dir: Lists the files and directories in the current directory.

Example: dir


cd (Change Directory): Changes the current directory.

Example: cd C:\Users\YourName\Documents


mkdir (Make Directory): Creates a new directory.

Example: mkdir new_folder


rmdir (Remove Directory): Deletes a directory.

Example: rmdir old_folder


del (Delete): Deletes one or more files.

Example: del file.txt


copy: Copies files from one location to another.

Example: copy file.txt C:\Backup


move: Moves files from one location to another.

Example: move file.txt D:\NewFolder


rename: Renames a file or directory.

Example: rename oldname.txt newname.txt


type: Displays the contents of a text file.

Example: type file.txt


cls: Clears the command prompt screen.

Example: cls


chkdsk (Check Disk): Checks a disk and displays a status report.

Example: chkdsk C:


format: Formats a disk for use with Windows.

Example: format D:


diskpart: Manages disk partitions.

Example: diskpart


tasklist: Displays a list of currently running processes.

Example: tasklist


taskkill: Terminates a task or process.

Example: taskkill /IM notepad.exe /F


ipconfig: Displays network configuration information.

Example: ipconfig /all


ping: Tests network connectivity to another host.

Example: ping google.com


netstat: Displays network statistics.

Example: netstat -a


attrib: Displays or changes file attributes.

Example: attrib +r file.txt


shutdown: Shuts down or restarts the computer.

Example: shutdown /s /f /t 0


systeminfo: Displays detailed configuration information about the computer.

Example: systeminfo


ver: Displays the version of the operating system.

Example: ver


echo: Displays messages or turns command echoing on or off.

Example: echo Hello World


set: Displays, sets, or removes environment variables.

Example: set PATH


path: Displays or sets a search path for executable files.

Example: path


hostname: Displays the computer's hostname.

Example: hostname


xcopy: Copies files and directories, including subdirectories.

Example: xcopy C:\source D:\destination /s /e


robocopy: Robust file and folder copy command with many options.

Example: robocopy C:\source D:\destination /mir


fc (File Compare): Compares two files or sets of files and displays the differences.

Example: fc file1.txt file2.txt


find: Searches for a text string in a file or files.

Example: find "keyword" file.txt


replace: Replaces files.

Example: replace newfile.txt C:\folder


tracert: Traces the route to a remote host.

Example: tracert google.com


nslookup: Queries the DNS to obtain domain name or IP address mapping.

Example: nslookup google.com


net: A collection of commands to manage network resources.

Example: net use (connects to a network share)


ftp: Transfers files to and from a remote system via FTP.

Example: ftp ftp.example.com

Notes and Source Code

Simple Empty
No data