Powershell and Robocopy

rr-4098 2,051 Reputation points
2023-06-17T15:37:05.4933333+00:00

I need use robocopy to copy 30 different source folders to their corresponding target folder. I was thinking about adding each robocopy line into powershell, but do not want each line to run at once . I only want the next robocopy command to start after the previous once completes.

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. MotoX80 36,411 Reputation points
    2023-06-17T16:16:23.9566667+00:00

    Just put those commands in a .ps1 file. They will run one after the other. Use the /l switch to test.

    robocopy.exe C:\Source1 D:\Dest1 /s /l
    robocopy.exe C:\Source2 D:\Dest2 /s /l
    robocopy.exe C:\Source3 D:\Dest3 /s /l
    

    You could also save that as a .bat file and run it with cmd.exe.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.