Create a batch file to copy and rename file

前端 未结 2 1056
傲寒
傲寒 2021-02-18 16:27

I need to write a batch file 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         


        
2条回答
  •  佛祖请我去吃肉
    2021-02-18 17:13

    Make a bat file with the following in it:

    copy /y C:\temp\log1k.txt C:\temp\log1k_copied.txt
    

    However, I think there are issues if there are spaces in your directory names. Notice this was copied to the same directory, but that doesn't matter. If you want to see how it runs, make another bat file that calls the first and outputs to a log:

    C:\temp\test.bat > C:\temp\test.log
    

    (assuming the first bat file was called test.bat and was located in that directory)

提交回复
热议问题