Question 144 of 750
Scripting BasicsmediumMultiple ChoiceObjective-mapped

Xcopy Only If Newer: Using the /d Switch for Conditional Copy

This 220-1202 practice question tests your understanding of scripting basics. This is a configuration task: choose the command set that satisfies every stated requirement. Small differences — like 'secret' vs 'password' or 'transport input ssh' vs 'all' — change whether the answer is correct. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

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?

Clue words in this question

Noticing these words before you look at the options changes how you read each choice.

  • Clue: "which command"

    Why it matters: Tests specific CLI syntax. Recall the exact command and its required context — near-synonyms and partial matches are common distractors.

Quick Answer

The answer is the `xcopy` command with the `/d` switch, specifically `xcopy \\server\share\config.txt C:\Windows\System32\ /d /y`. This is correct because the `/d` switch tells xcopy to only copy files when the source file is newer than the destination file, making it the ideal tool for a conditional copy in a batch script where you want to update a configuration file without overwriting a newer local version. On the CompTIA A+ Core 2 220-1202 exam, this tests your understanding of file management utilities and their switches, often appearing in scenario-based questions about scripting or system maintenance. A common trap is confusing `/d` with `/u` (which only copies files already in the destination) or forgetting that `/y` suppresses the overwrite prompt, which is essential for unattended scripts. A simple memory tip: think of `/d` as “date-check” — it only copies when the source’s date is newer.

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

Option B is correct because 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.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

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.

    Clue confirmation

    The clue word "which command" in the question point toward this answer.

    Related concept

    Read the scenario before looking for a memorised answer.

  • 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.

Common exam traps

Common exam trap: answer the scenario, not the keyword

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.

Trap categories for this question

  • Command / output trap

    The 'copy' command overwrites without checking file dates, so it would always copy.

Detailed technical explanation

How to think about this question

The `xcopy /d` switch compares the last-modified timestamps of source and destination files at the file system level (NTFS or FAT). If the source timestamp is later, the copy proceeds; if equal or earlier, it is skipped. This is a common technique in batch scripts for configuration deployment where only updated files should replace local copies, avoiding unnecessary network traffic and disk writes.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A practitioner preparing for the 220-1202 exam encounters this exact type of scenario on the job. The correct answer here is not the most general option — it is the best answer for the specific constraint described. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Real exam questions reward reading the full scenario before eliminating options, because the constraint defines which answer fits.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related 220-1202 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free 220-1202 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this 220-1202 question test?

Scripting Basics — This question tests Scripting Basics — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: xcopy \\server\share\config.txt C:\Windows\System32\ /d /y — Option B is correct because 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.

What should I do if I get this 220-1202 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Are there clue words in this question I should notice?

Yes — watch for: "which command". Tests specific CLI syntax. Recall the exact command and its required context — near-synonyms and partial matches are common distractors.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Keep practising

More 220-1202 practice questions

Last reviewed: Jul 4, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.