Batch Files

.docx

School

Western Nebraska Community College *

*We aren’t endorsed by this school

Course

COMPUTER F

Subject

Computer Science

Date

Apr 3, 2024

Type

docx

Pages

7

Uploaded by UltraLapwing3690

Report
Batch Files Time required: 30 minutes How to Create Screenshots: Please use the Windows Snip and Sketch Tool or the Snipping Tool. Paste a screenshot of just the program you are working on. If you are snipping a virtual machine, make sure your focus is outside the virtual machine before you snip. 1. Press and hold down the Windows key & Shift , then type S. This brings up the on- screen snipping tool. 2. Click and Drag your mouse around whatever you want to snip. 3. Release the mouse button. This places the snip into the Windows Clipboard. 4. Go into Word or wherever you want to paste the snip. Hold down CTRL , then type V to paste the snip. Lab Description A file with a bat or cmd extension is called a batch file. You use a batch file to automate command line commands. A batch file is sometimes called a script. XCopy Before you begin using Xcopy and Robocopy commands, you need to create a test directory to use when copying files. Follow these steps: 1. Open a command prompt window and make the root of drive C: the current directory. The quickest way to change to the root of a drive is to type C: (where T is the drive letter), and then press Enter. 2. Use the md command to make a directory in the drive C: root called copytest. Now you can begin experimenting with the Xcopy command. 3. Type xcopy /? and press Enter. xcopy Help information is displayed. Notice all the switches you can use to modify the xcopy command. In particular, you can use the /e switch to instruct xcopy to copy all files and subdirectories in a directory, including any empty subdirectories, to a new location. 4. Type xcopy “C:\program files (x86)\internet explorer” C:\copytest\ /e and then press Enter. (You must use quotation marks in the command line to surround a path, file name, or folder name containing spaces.) You’ll see a list of files scroll by as Use a Batch File Page 1 of 7
they are copied from the C:\program files\internet explorer folder to the C:\copytest folder. 5. Insert a screenshot of the copy results: 6. When the copy operation is finished, check the copytest folder to see that the files have been copied and the subdirectories created. 7. Enter a dir command with switches that will give you the total size of the copytest directory, including all the files in the directory and its subdirectories. What command did you use? dir C:\copytest 8. What is the total size of the copytest directory in bytes, including all files in the directory and its subdirectories? 1,790,287 bytes 9. What is the total size in MB? In GB? 1.79MB 0.00179GB Use a Batch File Page 2 of 7
10. Insert a USB flash drive or attach an equivalent removable device. To find the capacity of your USB flash drive, enter the command DIR E: (You might have to substitute the drive letter assigned to your storage device for E:) Add the bytes of used space and free space to determine the capacity of the drive. 11. What is the drive capacity of your USB flash drive in MB? In GB? 14.6GB 14600MB 12. What is the free space on your USB flash drive? Will all the files in the C:\ copytest directory fit on your flash drive? Yes, 9,851,473,920bytes= 9851MB=9.8GB free 13. Type MD E:\copytest , and then press Enter. 14. This command creates a directory named copytest on the H: drive. (Remember to use the letter for the drive assigned to your media device.) 15. To copy all files in the copytest directory on the hard drive to the copytest directory on drive H:, type Xcopy C:\copytest E:\copytest and then press Enter. The system begins copying files. If the flash drive does not have enough free space to hold the entire C:\copytest directory, the system displays a message stating that the device is out of space and asking you to insert another device. Did you get this error message? If so, what is the exact error message? 16. Insert a screenshot of the xcopy process: Use a Batch File Page 3 of 7
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help