Create a batch file to copy and rename file

Posted by Estate Master on Stack Overflow See other posts from Stack Overflow or by Estate Master
Published on 2010-06-17T00:05:38Z Indexed on 2010/06/17 0:12 UTC
Read the original article Hit count: 614

I have little to no experience in writing batch files.

I need to write one that copies a file to a new folder and renames it

At the moment, my batch file consists of only this command: COPY ABC.PDF \\Documents

As you can see, it only copies the file ABC.pdf to the network folder 'Documents'.

However i need to change this so it renames the file ABCxxx.pdf, where xxx is a text variable that i would like to set somewhere in the batch file.

For example, if xxx = "_Draft", then file would be renamed ABC_Draft.pdf after it is copied.

Thanks

© Stack Overflow or respective owner

Related posts about command-line

Related posts about batch-file