How to Write a Batch File to Copy a File




(5.00 out of 5)



(5.00 out of 5)



(5.00 out of 5)



(5.00 out of 5)



(5.00 out of 5)



(5.00 out of 5)



(5.00 out of 5)





How to Write a Batch File to Copy a File
Log in to answer.
Copyright © dBuggr LLC - All Rights Reserved.
nishantbaxi 9:17 pm on May 7, 2010
Step 1Open a text editor. Most administrators use Notepad to create a new batch file. Batch files are plain text, so any text editor is sufficient.
Step 2Type the following code into the batch file:
xcopy
The first parameter for xcopy is the file you want to copy and the second is the destination for the new, copied file. This line of code is all that is needed to copy a file.
Step 3Save the file with a .bat extension. If you are using Notepad, click “File,” “Save As,” and then name the file with the .bat extension.
Step 4Double-click the file to test the code. When you double-click a batch file, a DOS prompt opens and the file runs in the command line. The window automatically closes again.
Step 5View the directory where you copied the file. The copied file is now in the directory indicated in the batch file.