Operating Systems

A technician at a command prompt in C:\Users\Public needs to switch to the D: drive's Logs folder, D:\Logs, in the same command prompt window. Which command changes the current directory to D:\Logs?

Show the answer

Correct answerA. cd /d D:\Logs

AWhy this is right: The /d switch changes the current drive and directory together, so the prompt lands in D:\Logs.

BWhy not this: This goes to \Logs on the current C: drive, not to D:\Logs.

CWhy not this: dir only lists the contents of D:\Logs and never changes the current location.

DWhy not this: Without /d, this only sets D:'s current directory; the prompt stays on the C: drive.

The /d switch makes cd change the current drive as well as the directory, so cd /d D:\Logs moves to D:\Logs. Plain cd D:\Logs only changes the saved directory for D: and leaves the prompt on C:.