Today, a friend asked me to help solve the problem of batch copy of specified files. So I found a lot of batch processing commands and finally solved the problem. Principle: Integration Tree The file generated by the command, and then analyzes the file names in the generated file through the batch processing command, and then copies them to the specified directory in batches. Below are the steps:
First Open command line ( Win + R Open the run dialog box and enter CMD Open) Assume that E: \ txt Files in this folder
In DoS Command Line Input :
A file named File File
Open with notepad
We can see that Txt Folder All file names.
Now let's write the batch processing command:
Echo Make sure that the "file for saving the file name" File This program is in the same directory
Set/P lj = Enter the path to be copied:
For/F "tokens = *" % A in (File) Do (
For/F "tokens = *" % I in ('dir/S/B/a-d % A') Do (
Copy "% ~ Dpnxi "" % LJ %"
)
)
Save the preceding command . Bat File
The File File And Copyfile. bat Copy files together Txt Directory
Double-click Bat File Execute the batch processing program
Press ENTER The command flashed through : Finally, we ABC Folder found Txt Files copied in the folder
To better understand the execution process We can DoS Command Run . Bat File
Because File File contains such fields :
Therefore Batch query Name of the three rows If not Enter the next line The processing method is top-down. One row reads the file name
Okay, here. The entire process has been completed! Leave a message if you are not clear! Or mail to tienfook # gmail.com (# Change @)
@)