4

I want to create a variable in a batch file and I want to assign a path of a text file to to this variable. After that, I want to use this variable to copy that file. How can I do this?

Thank you,

4

1 回答 1

8

The general idea is this:

SET filename=c:\path\to\file.txt
COPY "%filename%" c:\destination

Note the quotes around %filename%: they are necessary to make the command work if the path or file name contains spaces.

于 2012-06-13T09:20:57.760 回答