How do I get robocopy to use a log file which includes spaces?

If you need to provide a path that includes spaces to robocopy's /log switch you can do it like this:

/log:"c:\path to logs files\some log file.txt"

There are four way of logging as the Powershell documentation

/log:<LogFile> : Writes the status output to the log file (overwrites the existing log file).

  • e.g: robocopy "c:\a" "c:\b" /log:"c:\copy_log.log"

/log+:<LogFile> : Writes the status output to the log file (appends the output to the existing log file).

  • e.g: robocopy "c:\a" "c:\b" /log+:"c:\copy_log.log"

/unilog:<LogFile> : Writes the status output to the log file as Unicode text (overwrites the existing log file).

  • e.g: robocopy "c:\a" "c:\b" /unilog:"c:\copy_log.log"

/unilog+:<LogFile> : Writes the status output to the log file as Unicode text (appends the output to the existing log file).

  • e.g: robocopy "c:\a" "c:\b" /unilog+:"c:\copy_log.log"

For more details https://technet.microsoft.com/en-us/library/cc733145(v=ws.11).aspx