Courseiva
mediumMultiple Choice

220-1202 Practice Question: A technician is troubleshooting a batch script…

A technician is troubleshooting a batch script that is supposed to delete temporary files older than 30 days. The script runs without errors but does not delete any files. The technician suspects the script's logic is flawed. Which part of the script is most likely incorrect?

⚠ Common exam trap

CompTIA A+ often tests the subtle difference between positive and negative date offsets in the 'forfiles' command, knowing that candidates may assume a positive number means 'older than' based on experience with other tools like Linux 'find'.

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

✓

The script uses 'forfiles' with the wrong date syntax

The 'forfiles' command in Windows uses a specific date syntax with the `/d` parameter. The correct syntax for files older than 30 days is `forfiles /d -30` (negative number means older than). If the script uses a positive number or an incorrect date format like `+30` or `30 days ago`, it will not match any files, resulting in no deletions. This is the most likely flaw given the symptom of no errors but no action.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    The script uses the 'del' command without a path

    Why it's wrong here

    Incorrect. Without a path, 'del' would prompt for confirmation or delete files in the current directory, but it wouldn't explain why no files are deleted at all.

  • ✓

    The script uses 'forfiles' with the wrong date syntax

    Why this is correct

    Correct. Forfiles uses the '/d' parameter with a date string like '-30' for days. If the syntax is wrong (e.g., using '30' instead of '-30'), it will not match any files.

  • ✗

    The script runs as a standard user without admin rights

    Why it's wrong here

    Incorrect. Lack of permissions would cause access denied errors, not silent failure to delete files.

  • ✗

    The script uses 'echo' instead of 'del'

    Why it's wrong here

    Incorrect. 'echo' would display a message, not delete files, but the technician said the script runs without errors; if it used 'echo', it would still output something.

About these practice questions

This 220-1202 question is part of Courseiva's 687-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.