Page 1 of 1

how to copy several files to somewhere?

Posted: 10 May 2012 04:21
by Mohammad_Dos
i want to copy two files for example c:\a.jpg and c:\a.txt to d:\

how to do it by 1 line command?
(not using "for" command)

Re: how to copy several files to somewhere?

Posted: 10 May 2012 04:28
by Fawers
Mohammad_Dos wrote:i want to copy two files for example c:\a.jpg and c:\a.txt to d:\

how to do it by 1 line command?
(not using "for" command)


In this example, this should work.

Code: Select all

copy /b C:\a.* D:\

Re: how to copy several files to somewhere?

Posted: 10 May 2012 04:40
by Mohammad_Dos
i just want to copy these certain files. not any more. some other files with the same name "a" my be exist

Re: how to copy several files to somewhere?

Posted: 10 May 2012 05:40
by foxidrive
Mohammad_Dos wrote:i want to copy two files for example c:\a.jpg and c:\a.txt to d:\

how to do it by 1 line command?
(not using "for" command)



My question is why do you want that?

Re: how to copy several files to somewhere?

Posted: 10 May 2012 05:45
by Squashman
Only way I can see to do it is with a FOR command.
for /F "tokens=*" %G in ('dir /a-d /b C:\a.txt C:\a.jpg') do copy %G D:\

Re: how to copy several files to somewhere?

Posted: 10 May 2012 05:47
by foxidrive
He doesn't want to use the for command, Squashman.

The solution is very simple - and it seems to me like it is a question from an academic course.

Re: how to copy several files to somewhere?

Posted: 10 May 2012 05:48
by Squashman
I suppose you could do this as well.
copy a.txt T:\ & copy a.jpg T:\

Re: how to copy several files to somewhere?

Posted: 10 May 2012 05:56
by foxidrive
Yeah. Maybe you should let him think for himself for such an elementary answer.

Re: how to copy several files to somewhere?

Posted: 10 May 2012 08:02
by Fawers
foxidrive wrote:and it seems to me like it is a question from an academic course.

I thought that as well.

Re: how to copy several files to somewhere?

Posted: 11 May 2012 04:54
by Mohammad_Dos
thanks to all :wink: