Reputation: 21
For example I have
xcopy "C:\windows\match\goal.cfg" "c:\Program Files\Gate\" /e /i /h /r /k /y
where the name of the folder match is dynamic and always changes. How can I variablize the path directly to point a file in match folder to copy to gate folder in program files?
Upvotes: 2
Views: 7840
Reputation: 20230
If you want to pass a folder name variable into the batch file you could use:
@echo off
set /p "folder=Enter folder name: "
xcopy "C:\windows\%folder%\goal.cfg" "c:\Program Files\Gate\" /e /i /h /r /k /y
Upvotes: 3