Robocopy Invalid Parameter #7 Log

左心房为你撑大大i 提交于 2019-12-12 05:36:48

问题


I've been cracking my head trying to fix this. But it seems this command line isn't working for my robocopy batch file. It has something to do with the parameters, quotation marks, backslashes or maybe I'm just blind. I'm not too sure. Here's the code.

REM @Echo Off
SETLOCAL EnableDelayedExpansion
Set hostname=%COMPUTERNAME%

set torun=wmic bios get serialnumber /format:value
for /f "tokens=2 delims==" %%a in ('%torun%') do set serial=%%a

Set src="D:\BackUPTEST\%serial%"
set dest="D:\RestoreTEST\%serial%"
set logdest="D:\RestoreTEST\%serial%\Logs"

set logfile=Restore-%serial%.log
set log="%logdest%\%logfile%"

robocopy %src% %dest% /E /R:3 /W:3 /TEE /log:%log% /NP

echo Restore Completed. . .
ENDLOCAL
Echo On

I'm returned with...

ERROR : Invalid Parameter #7 : "/log:D:\RestoreTEST\CNU1293K2J\Logs\Restore-CNU1293K2J.log"

   Simple Usage :: ROBOCOPY source destination /MIR

         source :: Source Directory (drive:\path or \\server\share\path).
    destination :: Destination Dir  (drive:\path or \\server\share\path).
           /MIR :: Mirror a complete directory tree.

For more usage information run ROBOCOPY /?

**** /MIR can DELETE files as well as copy them !


回答1:


Okay, figured out. As for Logging, there should be an existing Folder. So I simply added mkdir %logdest% before the robocopy command initializes... That seems to fix it.




回答2:


Just been hit by the dreaded "Invalid log parameter"! Been using it for a year or more without problem, running on a network drive, then Robocopy V10 hit my machine a few days ago and it stopped working with the following message:

'\\SEAGATE-435DC3\usb1-1share1\BACKUP'

CMD.EXE was started with the above path as the current directory. UNC paths are not supported. Defaulting to Windows directory.

C:\Windows>robocopy X:\Documents Y:\BACKUP\Documents /s /XO /FFT /DST /TEE /NP /R:2 /W:5 /LOG:robocopy_docs.log

2016/11/10 19:07:47 ERROR 5 (0x00000005) Opening Log File C:\Windows\robocopy_docs.log Access is denied.

So you now need to specify the path to the log file, then it works! (Y: is mapped to \SEAGATE-435DC3\usb1-1share1)



来源:https://stackoverflow.com/questions/40418395/robocopy-invalid-parameter-7-log

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!