CMD copy command file copy _dos/bat

Source: Internet
Author: User
Tags file copy cmd copy
Suppose you need to copy the D:\test\test.txt file to the D-Packing directory, then use the copy d:\test\test.txt d:\ can be easily done.

Of course, this is the simplest case, in actual use, still encounter very complex situation.

If a file named Test.txt already exists under the D-Packing directory, the copy command will prompt you to overwrite the original file, discard the copy, or overwrite all files when copying the past. If you are in bulk copy, cover the original file, then, one by one to choose very troublesome, this time, you can use without prompting to overwrite the original file parameters/y (equivalent to automatically select the Yes option), complete command for copy/y d:\test\test.txt d:\.

If you copy the time, you also need to change the source file name, such as the Test.txt to 1.txt, you can directly use: Copy d:\test\test.txt d:\1.txt Such a command, that is, in the specified destination path, directly specify the filename, then, The new filename is the name after the source file is copied.

If you want to copy a path with spaces, &, and other special symbols, enclose these special characters in quotes, such as copy "D:\test abc\test.txt" "D:\t&est"

Copy command In addition to the "copy" the function of the file, there is a unique skill: merge multiple files for a file, the specific format is: Copy file 1+ documents 3+ ... Destination path \ New file name. For example: Copy d:\test.txt+d:\abc.txt d:\test\test.txt, then, the D-Packing directory Test.txt and abc.txt two files of the contents of the merged into Test.txt, and saved to the D:\test directory.

Copy also has some parameters, but commonly used on the above usage, more usage please use copy/in the Command Line window. To inquire, it is easy to get started.

It is important to note that copy can only copy files, and for folders to replicate, you need to talant and use xcopy to copy them. Xcopy is a copy of the advanced version, there are more rich parameters, can achieve more complex functions, take all the files and folder replication, will be introduced later, here will not start to explain.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.