1

I have a program that searchs for a file on the local disk, then copy it in its' own directory.

SET MyProgramDir=%~dp0
for /f "delims=" %%i in ('where /r c:\ *MyFile') do set MyPath=%%i
set MyFilePath=%MyPath:~0,-6%
xcopy "%MyFilePath%" "%MyProgramDir%"

But it says that the path is invalid; 0 file copied. I don't get it, I tried with and without ", I tried to do like

set MyPath=%MyFilePath:~3%
set BatPath=%MyProgramDir:~3%
xcopy "C:\%MyPath" "C:\BatPath"
Maximilien
  • 93
  • 1
  • 4

0 Answers0