PowerTip: Use PowerShell to Copy Files

Summary: Learn how to use Windows PowerShell to copy files from one location to another.

Hey, Scripting Guy! Question How can I use Windows PowerShell to copy a file to a new location?

Hey, Scripting Guy! Answer Use the Copy-Item cmdlet and specify the path to the original file and a destination for the copy. In this example, file 20110314.log in the C:\fso folder is copied to folder C:\fsox with the new name mylog.log.

Note   The destination folder C:\fsox must exist.

Copy-Item -Path C:\fso\20110314.log -Destination c:\fsox\mylog.log