How to XCOPY files from the directory of the .BAT to a subfolder of that directory?

Viewed 21

guys, I'm having a problem here with XCOPY

On Windows 10, my .BAT seems to work just fine like this

XCopy /y /e "%~dp0\File.xlsx" "%~dp0\OLD"

On Windows 7, however, the same .BAT says "File.xlsx" cannot be found

All I want to do is batch-copy old excel sheets into a subdirectory of the folder in which the .BAT itself resides. The excel sheets are right next to the .BAT

What I tested was that this seems to occur only when you want to copy things into subdirectories of the location in which the .BAT is. If, say, I moved the "File.xlsx" to say "%~dp0\TO_COPY" and tried to XCOPY from there, it would work fine:

XCopy /y /e "%~dp0\TO_COPY\File.xlsx" "%~dp0\OLD"

Is there a way to do what I want to do with XCOPY - subdirectories of the .BAT location and all?

Thanks

0 Answers
Related