Converting the FileSystemObject's CopyFile Method

Windows PowerShell

Definition: Copies one or more files to a specified location.


Use wildcards with the Copy-Item cmdlet to copy multiple files. This example copies all txt files (files ending with .txt) from C:\Scripts to C:\Scripts\TextFilesOnly:

Copy-Item C:\Scripts\*.txt C:\Scripts\TextFilesOnly

C:\Scripts\TextFilesOnly must already exist for this command to work correctly. See CreateFolder for how to create a folder.

See conversions of other FileSystemObject methods and properties.
Return to the VBScript to Windows PowerShell home page