Batch file to copy a file to desktop

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
data808
Posts: 47
Joined: 19 Jul 2012 01:49

Batch file to copy a file to desktop

#1 Post by data808 » 22 Oct 2022 16:02

I have a batch file that will search and delete the files that I want. The code is this:

@echo off
del "%userprofile%\desktop\*hs_err_*.log"

So with that being said, how do I copy a file from a folder to the desktop using a batch file?

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Batch file to copy a file to desktop

#2 Post by aGerman » 23 Oct 2022 04:03

The command for copying a file is COPY.

Code: Select all

copy "source" "destination"
... where source and destination have to be customized.

Steffen

data808
Posts: 47
Joined: 19 Jul 2012 01:49

Re: Batch file to copy a file to desktop

#3 Post by data808 » 23 Oct 2022 19:09

Worked like a charm. Thank you very much!!

Post Reply