mediumMultiple ChoiceObjective-mapped
220-1202 Practice Question: Write a batch script that will copy a…
A technician needs to write a batch script that will copy a configuration file from a network share to the local system32 directory only if the file on the share is newer than the local copy. Which command should the technician use to perform this conditional copy?
⚠ Common exam trap
CompTIA A+ often tests the distinction between `copy`, `xcopy`, and `robocopy` switches, and the trap here is that candidates may choose `copy /y` thinking it is sufficient, overlooking the need for a timestamp-based conditional check that only `xcopy /d` provides.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
xcopy \\server\share\config.txt C:\Windows\System32\ /d /y
The `xcopy` command with the `/d` switch copies files only if the source file is newer than the destination file, and `/y` suppresses confirmation prompts. This meets the requirement of a conditional copy based on file timestamp comparison.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
copy /y \\server\share\config.txt C:\Windows\System32\
Why it's wrong here
The 'copy' command overwrites without checking file dates, so it would always copy.
- ✓
xcopy \\server\share\config.txt C:\Windows\System32\ /d /y
Why this is correct
Xcopy with /d copies only if the source is newer, and /y suppresses prompts.
- ✗
robocopy \\server\share C:\Windows\System32 config.txt /mir
Why it's wrong here
Robocopy /mir mirrors the entire directory, which is overkill and may delete files.
- ✗
move /y \\server\share\config.txt C:\Windows\System32\
Why it's wrong here
Move relocates the file, not copies, and does not check timestamps.
Go deeper
Related to this question
About these practice questions
One of 495 original 220-1202 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 220-1202 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 220-1202 exam.