VldGrdv
VldGrdv

Reputation: 3

Use variable for full path

For example, I have:

1) text.txt file in D:\Test folder

2) text.txt file in D:\x64_this-is-my-test_54321_99.88.77.555_folder_n12345 folder

How can I copy with replacement (xcopy /o /y)

text.txt file from Test folder to the x64_this-is-my-test_54321_99.88.77.555_folder_n12345 folder

by using command line (FOR /R [[drive:]path] %%parameter IN (set) DO command )

if I know only that the second folder name starts with x64_this-is-my-test, and the other part of the folder's name is unknown?

Upvotes: 0

Views: 87

Answers (1)

npocmaka
npocmaka

Reputation: 57252

for /d %%# in ("D:\x64_this-is-my-test*") do copy /y "D:\Test\text.txt" "%%~f#\test.txt"

using xcopy for single files is bad idea .Better use copy.

Upvotes: 1

Related Questions