CSC 1113 (P) Foundation of Computer Science (P)
CCCU 1113 (P) Fundamentals of Information Technology (P)
DOS Commands
• DOS (Disk Operating System) is a command-line interface (CLI) that allows users to interact with
the computer's file system and perform various tasks like managing files, executing programs, etc.
• This tutorial will cover all the essential DOS commands, along with descriptions of their functions.
Tasks for Directory Management Commands
1. Command use to list all files and directories in the current directory.
• DIR
2. Command used to display all the directories and files list them page by page.
• DIR /P
3. Command lists files and directories in wide format, displaying more than one filename per line.
• DIR /W
4. Command to see only the directories (folders) in your current working directory.
• DIR /AD
5. Command to list all hidden files in your current directory.
• DIR /AH
6. Command to display only the read-only files in the current directory.
• DIR /AR
7. Command to list all files and directories in alphabetical order by their names.
• DIR /ON
8. Command to sort the files in your current directory by their size, with the smallest files listed first.
• DIR /O:S
9. Command to sort files by their date of modification, showing the oldest files first.
• DIR /OD
10. Command to display only the filenames of files and directories without additional details like file size or
date modified.
• DIR /B
11. Command to display all files and directories with their names in lowercase.
• DIR /L
12. Command to displays the owner of each file and directory in the current folder.
• DIR /Q
13. Command to display the creation time of each file in the current directory.
• DIR /T:C
14. Command to list all files and directories in the current folder, including those in all subdirectories.
• DIR /S
15. Command lists only directories in alphabetical order.
• DIR /AD /ON
16. Command to display filenames only, in bare format, and in lowercase.
• DIR /B /L
17. Command to sort files by their file extensions.
• DIR /OE
18. Command to display the last time a file was written to or modified.
• DIR /T:W
Tasks for Directory Management and Navigation using MD, RD, CD, and CLS Commands
19. Command to clear the screen
• CLS
20. Command to create a directory named "Projects" in the current folder.
• MD Projects
21. Command to navigate into the "Projects" directory.
• CD Projects
22. Command to create a subdirectory named "Completed" inside the "Projects" folder.
• MD Completed
23. Command to navigate back to the parent directory (the one containing "Projects").
• CD..
24. Command to navigate to the root of the current drive.
• CD\
25. Command to navigate back into the "Projects" directory back from root directory.
• CD C:/DIR_NAME/DIR_NAME/Projects
26. Command to remove the "Completed" directory from inside the "Projects" folder.
• RD Completed
27. Again, recreate the Completed folder inside the Projects folder then try to remove the "Projects" directory
without deleting its contents.
• CD.. (To go back to the parent folder), then RD Projects
28. Command to remove the "Projects" directory and all its subdirectories (including any remaining folders like
"Completed").
• RMDIR /S Projects
29. Command to create a directory "Work" and inside it creates subdirectories "Drafts" and "Final". Then delete
the "Final" subdirectory.
• MD Work
• MD Work\Drafts Work\Final
• CD Work
• RD Final
30. Command to command to view the directories, subdirectories and files in a tree structure.
• Tree
• Tree /F
31. Command to create a directory structure with "Main", inside which you create "Archive" and "Backup"
directories. Then remove the entire structure using a single command.
• MD Main\Archive Main\Backup
• RMDIR /S Main
32. Command to navigate back to the "Work" directory if it still exists (if removed, recreate it).
• CD Work
33. Command to move up one directory level from the "Work" directory.
• CD..
Tasks for File and Folder Management using DEL, COPY, REN, MOVE, ERASE, and Directory
Commands
34. Command to create a new text file named "report.txt" inside the "Projects" folder.
• COPY CON report.txt
Type the following content:
✓ This is a sample report file.
✓ Detailed analysis of the project.
To save and exit, press: CTRL + Z then Enter
35. Command to view the contents of "report.txt" in the "Projects" folder using the TYPE command.
• TYPE report.txt
36. Command to copy the "report.txt" file to a new location (e.g., "Backup" folder inside the "Projects" folder).
First, create the "Backup" folder on Projects folder.
• MD Backup
• COPY report.txt Backup
37. Command to open the "report.txt" file in the "Backup" folder and add the line at last "This is an updated
summary."
• EDIT Backup\report.txt
• After editing, use TYPE to verify that the changes have been made to the file
➢ If the EDIT command is not working (which can happen in modern versions of Windows where the command is no
longer supported)
38. Command to append the content to the file.
• ECHO This is an updated summary >> Backup\report.txt
• Use the > operator to overwrite the content of a file and >> to append content without overwriting the
existing data.
39. Command to move the "report.txt" file from the "Projects" folder to the "Final" folder.
• Create Final folder inside the Projects then move
• MD Final
• MOVE report.txt Final
40. Command to rename the file "report.txt" in the "Backup" folder to "final_report.txt".
• REN Backup\report.txt final_report.txt
41. Command to delete the "final_report.txt" file from the "Backup" folder.
• DEL Backup\final_report.txt
42. Command to create multiple text files (e.g., "file1.txt", "file2.txt", "file3.txt") in the "Projects" directory.
COPY CON file1.txt
Hello, this is file 1.
CTRL + Z
COPY CON file2.txt
Hello, this is file 2.
CTRL + Z
COPY CON file3.txt
Hello, this is file 3.
CTRL + Z
43. Command to delete all text files in the "Projects" directory.
• ERASE *.txt
✓ COPY used to backup files by copying them from one location to another. The XCOPY command is more powerful, as
it allows for copying directories and subdirectories.
44. Command to back up the "Final" folder (if it contains files) to the "Backup" folder using XCOPY.
• XCOPY Final Backup /E /I
Tasks for System Information and Disk Commands
45. Command to display the disk volume label and serial number for drive C:.
• VOL C:
46. Command to check for errors on the C: drive using CHKDSK.
• CHKDSK C:
47. Command to format a drive (e.g., D:) for use with DOS.
• FORMAT D: (Don’t try)
48. Command to format a non-existent drive (e.g., X:) and observe the error message.
• FORMAT X:
Tasks for Networking and Batch Commands
49. Command to test connectivity to Google’s server using the PING command.
• PING google.com
50. Command to test the connectivity to a local network device (e.g., a router or another computer).
• PING 172.16.180.250
51. Command to test connectivity to a website that doesn’t exist (e.g., fake_website.com).
• PING fake_website.com
52. Command to view your computer’s current IP configuration.
• IPCONFIG
53. Command to view detailed network information, including the MAC address and DNS server information.
• IPCONFIG /ALL
54. Command to view all shared resources on your local network.
• NET VIEW
55. Command to check the user accounts on your local machine.
• NET USER
56. Command to create a new user account named "TestUser" (optional, depending on permissions).
• NET USER TestUser /ADD