Sign in to follow this  
Followers 0
DevilChris

Help~ Converting xcopy to robocopy

2 posts in this topic

Hi,

I have tried converting xcopy func from part of a script to robocopy, it works but the parameter is placed wrong inside the " which i have no idea where to slove the error. Any kind soul can help to troubleshoot?

 

Original Code

Func _CopyFiles(ByRef $strSearch, ByRef $ArrayItem)
    Local $strRunXcopy
    $strRunXcopy = " xcopy.exe """ & $strSearch & """ """ & $SavePath _
             & $CopyPath[$ArrayItem] & """ /y /s /h /i /c /k"
    If $LogFlag = 1 Then
        $strRunXcopy &= " >>" & Chr(34) & $LogPath & $LogType & Chr(34) & " 2>&1"
    EndIf
    RunWait(@ComSpec & " /c title " & $CopyPath[$ArrayItem] & "|" & $strRunXcopy, "", @SW_HIDE)
EndFunc   ;==>_CopyFiles

Converted by me

Func _CopyFiles(ByRef $strSearch, ByRef $ArrayItem)
    Local $strRunXcopy
    $strRunXcopy = " Robocopy.exe """ & $strSearch & """ """ & $SavePath _
             & $CopyPath[$ArrayItem] & """/s /copy:DAT /256 /xd /ts /eta"
    If $LogFlag = 1 Then
        $strRunXcopy &= " >>" & Chr(34) & $LogPath & $LogType & Chr(34) & " 2>&1"
    EndIf
    RunWait(@ComSpec & " /c title " & $CopyPath[$ArrayItem] & "|" & $strRunXcopy, "", @SW_HIDE)
EndFunc   ;==>_CopyFiles

Thanks

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

try to use ' first then you have no problem with ' " '

$strRunXcopy = ' xcopy.exe '"' & $strSearch & '"' & '"' & $SavePath _
             & $CopyPath[$ArrayItem] & '"' & ' /y /s /h /i /c /k'
Edited by Spider001

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0