Share via

Robocopy invalid parameter 3

Anonymous
2018-12-13T23:18:53+00:00

Not sure what I'm doing wrong here but this script keeps telling me that a parameter is invalid and I can't figure out why.. I moved the parameters to a variable because somebody suggested that might work but I also tried 

Robocopy "$StartLocation" "$EndLocation" /SEC /E /XX /MINLAD:1 /MOV /A-:SH /XF "*FULL*.bak"

Keep getting this error 

  Started : Thursday, December 13, 2018 5:11:51 PM

   Source - L:\FakeLocation

     Dest - \ThisIsA\FakeLocation\ButThereAreNo\Spaces

NULL

    Files : 

  Options : /DCOPY:DA /COPY:DAT /R:1000000 /W:30 

NULL


NULL

ERROR : Invalid Parameter #3 : " /SEC"

Below is my shoddy code

PARAM($StartLocation="L:\FakeLocation",

$EndLocation="\ThisIsA\FakeLocation\ButThereAreNo\Spaces",

$Job='1')

$Options = "/SEC /E /XX /MINLAD:1 /MOV /A-:SH /XF ""*FULL*.bak"""

$Options2 = "/SEC /E /XX /MINLAD:7 /MOV /A-:SH"

$Options3 = "/SEC /E /XX /MINLAD:1 /MOV /A-:SH"

IF ($JOB='1')

{

Robocopy "$StartLocation" "$EndLocation" $Options

Robocopy "$StartLocation" "$EndLocation" $Options2

}

IF ($JOB='2')

{

Robocopy "$StartLocation" "$EndLocation" $Options3

}

Windows for home | Windows 10 | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2018-12-19T18:04:07+00:00

    I actually found the issue in where I was passing the params from sql.. it had an extra " at the end of the file path and was including that in the third parameter which was an integer so instead of the third parameter being 2 it was "2

    Well, this would have been a pretty hard one for forum respondents, seeing that the command you posted was not the command you ran . . .

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2018-12-13T23:48:14+00:00

    Run this working version in a cmd.exe console rather than in PowerShell, then modify it one step at a time to suit your environment until it fails:

    robocopy D:\Source D:\Target  /SEC /E /XX /MINLAD:1 /MOV /A-:SH /XF "*FULL*.bak"

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2018-12-19T16:31:39+00:00

    I actually found the issue in where I was passing the params from sql.. it had an extra " at the end of the file path and was including that in the third parameter which was an integer so instead of the third parameter being 2 it was "2

    Was this answer helpful?

    0 comments No comments