+ Reply to Thread
Results 1 to 4 of 4
  1. Junior Member Registered Member
    Join Date
    Oct 2017
    Posts
    5
    #1

    Default Command Prompt question

    Hi all, learning the command prompt on windows for the first time. While studying I came across the "copy" command and I have been trying to copy two files at one time to a different folder. The command syntax I've been using is: copy file1+file2+file3 destination. What ends up happening is the files (when I've done it they were .txt files) "merged" together. I list tge three seperate files and they copy over as one file. When I open that file, the text of all 3 files are there.

    Is there a way to copy more than one file to a different destination using one input? I know wildcards, but I'm talking files of different types.

    Thanks to any and all help in advance!
    Reply With Quote Quote  

  2. SS
  3. Senior Member
    Join Date
    May 2013
    Posts
    1,472

    Certifications
    CISSP, CISA, GWAPT, GSEC
    #2
    See the below link on using a for loop.

    https://stackoverflow.com/questions/...-a-single-copy
    Reply With Quote Quote  

  4. Senior Member Phalanx's Avatar
    Join Date
    Apr 2017
    Location
    UK
    Posts
    320
    #3
    An easier way than doing a loop is to use the ampersand.

    eg. copy file1 & copy file2
    Data Privacy & Project/Service Management: PECB GDPR DPO/Practitioner | ITIL 2011: Foundation
    Client & Security:
    MCSE: Mobility | MCSA: Windows 10 | MCITP: Windows 7
    Server & Networking:
    MCSA: Windows Server 2016 | MTA: Networking Fundamentals
    Currently Studying: Project+
    Reply With Quote Quote  

  5. Senior Member
    Join Date
    May 2006
    Posts
    2,159

    Certifications
    CISSP, CCSP, CCNA Cyber Ops, eJPT, ITIL,PA ACE,Qualys Certified Specialist, A+
    #4
    Quote Originally Posted by Nonazoona View Post
    Hi all, learning the command prompt on windows for the first time. While studying I came across the "copy" command and I have been trying to copy two files at one time to a different folder. The command syntax I've been using is: copy file1+file2+file3 destination. What ends up happening is the files (when I've done it they were .txt files) "merged" together. I list tge three seperate files and they copy over as one file. When I open that file, the text of all 3 files are there.

    Is there a way to copy more than one file to a different destination using one input? I know wildcards, but I'm talking files of different types.

    Thanks to any and all help in advance!
    Use the other two commands, xcopy and robocopy, they have more advanced features. Also, if you type <command name> /? It will give you more information on how the command is used.
    Reply With Quote Quote  

+ Reply to Thread

Social Networking & Bookmarks