220-1102 Question 782
Single answerScript file typesA technician needs to automate a Windows 10 workstation setup after imaging. The script must create local folders, copy files, and map a network drive using native Windows command-line tools. The technician wants the script to run by double-clicking it from File Explorer without requiring additional scripting environments to be installed. Which script file type is the best choice?
- A
.bat
- B
.ps1
- C
.vbs
- D
.sh
Show answer and explanation
Correct answer: A
Explanation
For A+ Core 2, candidates should recognize common script file types and when each is appropriate. In Windows, .bat files are traditional batch scripts interpreted by cmd.exe and are commonly used for administrative automation involving native command-line utilities. They are especially appropriate for tasks such as directory creation, file operations, and network drive mapping. While .ps1 PowerShell scripts are more powerful and commonly used in modern administration, they are subject to execution policy controls and do not behave as simply as batch files when a user just double-clicks them in File Explorer. .vbs scripts are valid Windows script files but are less commonly chosen for simple command-shell workflows. .sh is associated with Linux shell environments rather than standard Windows scripting. Microsoft documentation on batch files, Command Prompt commands, and PowerShell execution policies supports these distinctions and reflects common desktop support best practices.
- A. Correct.
Correct. A .bat file is a batch script executed by the Windows Command Prompt (cmd.exe). It is well suited for native command-line tasks such as creating folders with mkdir, copying files with copy or xcopy/robocopy, and mapping drives with net use. On a standard Windows system, batch files can typically be run directly from File Explorer without installing anything extra.
- B. Incorrect.
Incorrect. A .ps1 file is a Windows PowerShell script and is powerful for automation, but it is not the best choice for this requirement as stated. PowerShell is built into modern Windows versions, but double-clicking a .ps1 file in File Explorer does not reliably execute it as users might expect; execution policy and file association behavior can prevent straightforward double-click execution. This makes it less suitable when the requirement specifically emphasizes simple double-click use without extra handling.
- C. Incorrect.
Incorrect. A .vbs file is a VBScript file and can automate Windows tasks through Windows Script Host. However, for straightforward command-line setup tasks like folder creation, file copying, and drive mapping with native command tools, it is less direct than a batch file. It is plausible because it is a native Windows script type, but it is not the simplest or most appropriate match for the scenario.
- D. Incorrect.
Incorrect. A .sh file is typically a shell script used in Linux or UNIX-like environments. Windows does not natively execute .sh files through its standard command shell in the way described. A technician might choose this if they are familiar with Bash scripting, but it does not fit a normal Windows 10 native scripting scenario.