Batch - copy file using relative path
78,512
Solution 1
if you start your path with \
, it's an absolute, not a relative path.
Try copy "Debug\text.txt" "..\..\new"
instead
Solution 2
if you have Debug
subdir try with
md "..\..\new" >nul 2>&1
copy ".\Debug\text.txt" "..\..\new"
md
will create a new
directory two levels up if you don't have it already.
Author by
Admin
Updated on April 16, 2021Comments
-
Admin about 3 years
I'm a beginner with batch. I would like to copy file in
\Debug\test.ext
into..\..\new
by batch command.I tried
copy "\Debug\text.txt" "..\..\new"
, but get error "the system cannot find the file specified"