How to create a String variable and use a package

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

Thanks,

+4
source share
1 answer

The general idea is this:

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

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

+7
source

All Articles