1.5 Given a scenario, use the appropriate Microsoft command-line tools.
📘CompTIA A+ Core 2 (220-1202)
1. File Management with Command-Line Tools
In Windows, you can manage files and folders using Command Prompt (cmd.exe). This is very powerful for IT professionals because you can automate tasks, work on servers without a graphical interface, or handle large numbers of files quickly. Three important commands for creating, removing, and copying files/folders are:
md– Make Directoryrmdir– Remove Directoryrobocopy– Robust File Copy
1.1 md (Make Directory)
Purpose:
The md command (also called mkdir) is used to create a new folder (directory) from the command line.
Syntax:
md [path\foldername]
Examples:
md C:\Projects
- Creates a folder called Projects in the C: drive.
md C:\Projects\2026\Reports
- Creates multiple nested folders at once: 2026 and inside it Reports.
Key Points for Exam:
mdcan create nested folders in one command.- It is quick to use for scripts or automated tasks.
- Useful in IT when deploying software that needs specific folder structures on multiple machines.
1.2 rmdir (Remove Directory)
Purpose:
The rmdir command is used to delete folders. By default, it only removes empty folders.
Syntax:
rmdir [path\foldername]
Examples:
rmdir C:\Projects\Old
- Deletes the folder Old if it’s empty.
rmdir /s /q C:\Projects\Old
/s→ Removes all files and subfolders inside the folder (recursive delete)/q→ Quiet mode, no confirmation prompts- Deletes Old and everything inside it silently.
Key Points for Exam:
rmdiris for removing directories, not individual files.- Use
/sto delete a folder and all its contents. - Use
/qto avoid prompts during automation. - Very common in IT for cleaning up old project directories or temporary folders on servers.
1.3 robocopy (Robust File Copy)
Purpose:robocopy is a powerful file and folder copy tool. It is more reliable than the regular copy or xcopy commands because it can resume interrupted copies, copy large folders, and handle file attributes.
Syntax:
robocopy [source] [destination] [options]
Examples:
robocopy C:\Projects D:\Backup
- Copies all files and folders from C:\Projects to D:\Backup.
robocopy C:\Projects D:\Backup /E /Z /COPYALL
/E→ Copy all subfolders, including empty ones/Z→ Restartable mode (good for network interruptions)/COPYALL→ Copies all file attributes, timestamps, and permissions
Why IT Pros Use robocopy:
- Backing up files from servers to external storage or network drives.
- Migrating data between directories or drives without losing permissions.
- Automating large file transfers in scripts or batch jobs.
Key Points for Exam:
robocopyis more advanced than copy/xcopy.- Handles large directories and maintains file security permissions.
- Can resume copying if a network fails, making it highly reliable.
Summary Table for Exam
| Command | Purpose | Key Options / Notes |
|---|---|---|
md | Create a folder | Can create nested folders in one command |
rmdir | Remove a folder | /s deletes all files/folders, /q suppresses prompts |
robocopy | Copy files/folders robustly | /E copy subfolders, /Z restartable, /COPYALL copies all attributes |
Exam Tips
- Remember
md= make directory,rmdir= remove directory,robocopy= robust copy. rmdiralone only deletes empty folders;/sis required for full deletion.robocopyis the go-to for server backups and large folder copies.- Understand syntax and options, because multiple-choice questions often test whether you know which command and flags to use in IT scenarios.
