1.5 Given a scenario, use the appropriate Microsoft command-line tools.
📘CompTIA A+ Core 2 (220-1202)
When working in Windows, sometimes the Command Prompt (cmd.exe) is used instead of the graphical interface (File Explorer). This is especially useful in IT tasks like managing files on servers, troubleshooting systems, or scripting tasks.
Two of the most basic and essential navigation commands are:
1. cd – Change Directory
- Purpose:
Thecdcommand is used to move between folders (directories) in the file system. - Syntax:
cd [path][path]can be either absolute or relative.
a) Absolute Path
- An absolute path is the full location of a folder from the root of the drive.
- Example:
cd C:\Users\Pooja\Documents- This moves you directly to the Documents folder under the Pooja user profile on the C: drive.
- Useful when you know the exact location of a folder.
b) Relative Path
- A relative path is relative to your current folder.
- Example: Suppose you are currently in
C:\Users\Pooja:cd Documents- This moves you into the Documents folder inside the current folder.
c) Navigate to the Parent Folder
- To move one level up in the folder hierarchy:
cd ..- Example: If you are in
C:\Users\Pooja\Documentsand typecd .., you go back toC:\Users\Pooja.
- Example: If you are in
- To go up multiple levels:
cd ..\..- This moves you two levels up.
d) Switch Drives
- If you need to move to a different drive, type the drive letter first:
D:- Then you can use
cdto navigate folders on that drive.
- Then you can use
2. dir – List Directory Contents
- Purpose:
Thedircommand is used to see the contents of a folder: files and subfolders. This helps you know where you can go or what files you can work with. - Syntax:
dir [options] - Basic Use:
dir- Displays all files and folders in the current directory.
- Shows information like:
- File/folder name
- Size
- Date and time it was last modified
Common Options for dir
dir /w– Wide format (lists items in multiple columns to save space)dir /p– Pause after each screenful of information (useful for folders with many files)dir /a– Shows hidden and system filesdir /s– Shows all files in the current folder and all subfolders recursively
Example in an IT Environment
Suppose you are a technician managing a server:
- You open Command Prompt.
- You want to check the log files stored in
C:\Logs\System.cd C:\Logs\System - To see which log files are available:
dir - If you need to check older logs stored in a subfolder called
Archive:cd Archive dir /p
These commands are crucial for troubleshooting, finding files, or running scripts because GUI navigation may not be available, especially on remote servers or during system repair.
Key Points for the Exam
cdis used to change folders.diris used to list files and folders.- Remember:
cd ..→ go back one folder- Absolute vs. relative paths are both valid
dir /ashows hidden/system files
Knowing these commands lets you move around and inspect file systems efficiently, which is a core skill for IT support and is tested on the CompTIA A+ exam.
