Solved Edit a line in a batch file from the same batch file

July 29, 2012 at 16:46:48
Specs: Windows 7
I really wonder... is it possible to change a line in a batch file from the same (or another) batch file? In a batch file there is a written directory to where i take backup of something.
It is on line 32 and is like this example
copy "Filename" "Directory" /Y
Is it possible, through the same batch file, to change that directory, in line number 32?
In that case: How do i do it?

Thanks in advance.


See More: Edit a line in a batch file from the same batch file

Report •

#1
July 29, 2012 at 22:16:38
✔ Best Answer
The easiest (and best, i think) way is make target directory-name content of variable. That variable's content can come from a) a file, b) a prompt, or c) command-line. All depends on how you want to use, and what your criteria and restrictions are.
from your base:
copy /y "Filename" "Directory"

here are options I have described:
set /p dest<file.txt
set /p dest=Your destination for copy:
set dest="%*"

then: copy /y "Filename" %dest%


Report •
Related Solutions


Ask Question