none
Variable and Argument Error When Trying to run a software using Start-Process -Wait RRS feed

  • Question

  • $userAccName = "John"
    $sourcePath = ".\users"
    $destination = ".\destination"

    start-process-wait.\FastCopy311_x86\FastCopy.exe /CMD=MOVE /error_stop=FALSE /force_start=FALSE /acl /skip_empty_dir=FALSE /no_ui /log=TRUE /filelog=".\LOGS\$userAccName.log" "$userFolder" /to="$destination\"

    Sunday, May 8, 2016 2:15 PM

Answers

  • You don't need Start-Process. Just run the command.


    $userAccName = "John"
    $sourcePath = ".\users"
    $destination = ".\destination"
    .\FastCopy311_x86\FastCopy.exe /CMD=MOVE /error_stop=FALSE /force_start=FALSE /acl /skip_empty_dir=FALSE /no_ui /log=TRUE /filelog=.\LOGS\$userAccName.log $userFolder /to=$destination
    

    PowerShell is a shell. You can just type in commands, press Enter, and PowerShell will run them.


    -- Bill Stewart [Bill_Stewart]



    Sunday, May 8, 2016 8:13 PM
    Moderator

All replies

  • Hi Diogenes,

    this is because powershell interprets the arguments you want to pass to fastcopy as arguments for Start-Process. I don't know about fastcopy - I've yet to find a copy-tool I wanted to use over robocopy - but assuming your parameterization for fastcopy was correct, then this should do the trick:

    start-process -wait -FilePath .\FastCopy311_x86\FastCopy.exe -ArgumentList @("/CMD=MOVE", "/error_stop=FALSE", "/force_start=FALSE", "/acl", "/skip_empty_dir=FALSE", "/no_ui", "/log=TRUE", "/filelog='.\LOGS\$userAccName.log'", "$userFolder", "/to='$destination\'")

    Cheers,
    Fred


    There's no place like 127.0.0.1

    Sunday, May 8, 2016 3:07 PM
  • You don't need Start-Process. Just run the command.


    $userAccName = "John"
    $sourcePath = ".\users"
    $destination = ".\destination"
    .\FastCopy311_x86\FastCopy.exe /CMD=MOVE /error_stop=FALSE /force_start=FALSE /acl /skip_empty_dir=FALSE /no_ui /log=TRUE /filelog=.\LOGS\$userAccName.log $userFolder /to=$destination
    

    PowerShell is a shell. You can just type in commands, press Enter, and PowerShell will run them.


    -- Bill Stewart [Bill_Stewart]



    Sunday, May 8, 2016 8:13 PM
    Moderator