Sanctuary
Sanctuary

Reputation: 375

Can not copy file using robocopy

robocopy %~dp0 "%ProgramFiles(x86)%\StartIsBack\Orbs" "windows orb.bmp"

I need to copy just one file "windows orb.bmp" to "%ProgramFiles(x86)%\StartIsBack\Orbs", but what I see: if source folder has a space in its' name, I get an error

Source - D:\Programs\StartIsBack\
Destination - C:\Windows\system32\Win\
ERROR: Invalid parameter #3 : "10\"

So if you can see destination folder is wrong. But as soon as I delete space in folder name, file get copied. I do not understand where to dig. Batch file is being excuted from the same folder where "windows orb.bmp" is.

Upvotes: 0

Views: 1362

Answers (1)

Sanctuary
Sanctuary

Reputation: 375

 robocopy "%~dp0." "%ProgramFiles(x86)%\StartIsBack\Orbs" "windows orb.bmp"

So %~dp0 need to be quoted and put a dot at the end if source folder has spaces in its' name.

Upvotes: 1

Related Questions