220-1102 exam dumps

220-1102 practice question 783 of 828

A+ Core 2. Associate level, CompTIA. Free question with the correct answer and a full explanation.

220-1102 Question 783

Single answer.bat

A help desk technician needs to automate a repetitive cleanup task on several Windows 10 PCs. The task should delete temporary files from C:\Temp and then write a confirmation message to the screen. The technician wants to use a simple Windows batch file that other technicians can run by double-clicking it. Which of the following contents should the technician place in a .bat file to complete this task correctly?

  1. A

    del C:\Temp*.* echo Cleanup complete

  2. B

    rm -rf C:\Temp*.* printf "Cleanup complete"

  3. C

    erase-temp C:\Temp write-host Cleanup complete

  4. D

    delete C:\Temp*.* print Cleanup complete

Show answer and explanation

Correct answer: A

Explanation

Windows batch files (.bat) use Command Prompt (CMD) syntax, so technicians must use valid CMD commands. For deleting files, DEL (or its alias ERASE) is appropriate. For displaying output to the user, ECHO is the standard command. This makes Option 1 the best answer. In real-world support environments, batch files are often used for simple automation tasks such as cleanup, mapping drives, or launching support tools. Microsoft CMD command references document DEL and ECHO as standard commands for these purposes. Administrators should also be careful not to mix Bash or PowerShell syntax into .bat files unless they explicitly call those environments.

  • A. Correct.

    Correct. In a Windows .bat file, the DEL command is a valid command for deleting files, and ECHO is used to display text in the command prompt window. This is the standard batch-file approach for a simple cleanup-and-confirmation task. A technician might also use DEL /Q for quiet deletion in a production script, but the commands shown here are valid and appropriate.

  • B. Incorrect.

    Incorrect. RM and PRINTF are common in Linux/Unix shells such as Bash, not standard commands for a Windows batch (.bat) file. A candidate might choose this option if they confuse shell scripting across operating systems.

  • C. Incorrect.

    Incorrect. ERASE is a valid alias for DEL in Command Prompt, but ERASE-TEMP is not a valid built-in batch command, and WRITE-HOST is a PowerShell command rather than a .bat command. This option mixes scripting environments, which is a common administrative mistake.

  • D. Incorrect.

    Incorrect. DELETE and PRINT are not the correct commands for this task in a Windows batch file. DELETE is not a standard CMD command for file removal, and PRINT in Windows is used for sending text files to a printer, not displaying status text to the console. This distractor targets confusion between natural-language command names and actual command syntax.

Timed practice exam

Take a 220-1102 practice test under exam conditions

90 questions in 90 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam