163k views
4 votes
Can you write a batch file using these instructions?

A). Starting from the root directory of drive C, display a list of all files starting with the letter a that have a file extension of .exe, and pause after each screenful of information
B). Starting from the root directory of drive C, display a list of all files with a file extension of .com, and pause after each screenful of information
C). Starting from the root directory of drive C, display a list of all files where the second letter of the filename is i that have a file extension of .exe, and pause after each screenful of information

1 Answer

1 vote

Final answer:

To address the request, three separate commands are written for a Windows batch file. Each command uses 'dir' to list files based on the specific criteria and pauses with '/p'. The commands are saved with .bat extension to create the batch file.

Step-by-step explanation:

Creating a Batch File with Specific Instructions

To create a batch file that performs the described actions, use the following script:

  • A) To display a list of all files starting with the letter a that have a file extension of .exe from the root directory of drive C, and pause after each screenful:
dir C:\a*.exe /s /p
  • B) To display a list of all files with a file extension of .com from the root directory of drive C, and pause after each screenful:
dir C:\*.com /s /p
  • C) To display a list of all files where the second letter of the filename is i that have a file extension of .exe from the root directory of drive C, and pause after each screenful:
dir C:\?i*.exe /s /p

Copy and paste each of these commands into a text file and save it with a .bat extension. To run the batch file, simply double-click on the saved file.

User Robert Altman
by
7.9k points