So I've got the following block of code to robocopy some user data over the network:
$localFiles = "C:\Users\"
$netFiles = "\\netLocation\migration\Users\"
Start-Process "RoboCopy.exe" -NoNewWindow -argumentlist " `"$localFiles\`" `"$netFiles\`" /s /r:1 /w:5 /mt:16"
I have another, similar block of code directly underneath it that copies the same files to an external USB drive. What happens is, the first RoboCopy runs and immediately after the second one runs in unison. What I'd like to do is have the first function wait for RoboCopy to complete before it runs the second function. I have tried the -Wait argument, and that does not appear to work.
Thank you for your time!