PowerTip: Use PowerShell to Copy Source to Multiple Destinations

Doctor Scripto

Summary: Use Windows PowerShell to copy a source directory to multiple destinations.

Hey, Scripting Guy! Question How can I use Windows PowerShell to make multiple backup copies of a source directory without wasting a
           lot of time mousing around?

Hey, Scripting Guy! Answer Copying a single source directory to multiple destinations can be a single line command, for example:

"c:\fso1","c:\fso2","c:\fso3" | % {Copy-Item c:\fso -Recurse -Destination $_}

Note  The % symbol is an alias for the Foreach-Object cmdlet.


Discussion is closed.

Feedback usabilla icon