| Written by Diana, on 03-09-2007 23:35 |
| Views |
140  |
|
|
|
PS C:\Users\Admin> help cpi -full
NAME Copy-Item
SYNOPSIS Copies an item from one location to another within a namespace.
SYNTAX Copy-Item [-path] <string[]> [[-destination] <string>] [-container] [-recurse] [-force] [-include <string[]>] [-exclude <string[]>] [-filter <string>] [-passThru] [-credential <PSCredential>] [-whatIf] [-confirm] [<CommonParameters>]
Copy-Item [-literalPath] <string[]> [[-destination] <string>] [-container] [-recurse] [-force] [-include <string[]>] [-exclude <string[]>] [-filter <string>] [-passThru] [-credential <PSCredential>] [-whatIf] [-confirm] [<CommonParameters>]
DETAILED DESCRIPTION Copies an item from one location to another in a namespace. Copy-Item does not delete the items being copied. The particular items that the cmdlet can copy depend on the Windows PowerShell providers available. For example, when used with the FileSystem provider, it can copy files and directorie s and when used with the Registry provider, it can copy registry keys and entries.
PARAMETERS -path <string[]> Specifies the path to the items to copy.
Required? true Position? 1 Default value N/A - The path must be specified. Accept pipeline input? true (ByValue, ByPropertyName) Accept wildcard characters? true
-destination <string> Specifies the path to where the items are to be copied.
Required? false Position? 2 Default value <Current location> Accept pipeline input? true (ByPropertyName) Accept wildcard characters? false
-container <SwitchParameter> Preserves container objects during the copy operation.
Required? false Position? named Default value True Accept pipeline input? false Accept wildcard characters? false
-recurse <SwitchParameter> Specifies a recursive copy.
Required? false Position? named Default value False Accept pipeline input? false Accept wildcard characters? false
-force <SwitchParameter> Allows cmdlet to override restrictions such as renaming existing files as long as security is not compromised.
Required? false Position? named Default value False Accept pipeline input? false Accept wildcard characters? false
-include <string[]> Specifies only those items upon which the cmdlet will act, excluding all others.
Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false
-exclude <string[]> Omits the specified items. Wildcards are permitted.
Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false
-filter <string> Specifies filter elements as required and supported by providers.
Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false
-passThru <SwitchParameter> Passes the object created by this cmdlet through the pipeline. By default, this cmdlet does not pass any objects through the pipeline.
Required? false Position? named Default value False Accept pipeline input? false Accept wildcard characters? false
-credential <PSCredential> The credential is used to validate access. If a PSCredential object obtained earlier using get-credential is supplied, it will be used as is. If a user name is supplied, there will be a prompt for a password.
Required? false Position? named Default value Accept pipeline input? true (ByPropertyName) Accept wildcard characters? false
-literalPath <string[]> Specifies a path to the item. The value of -LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.
Required? true Position? 1 Default value Accept pipeline input? true (ByPropertyName) Accept wildcard characters? false
-whatIf Describes what would happen if you executed the command without actually executing the command.
Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false
-confirm Prompts you for confirmation before executing the command.
Required? false Position? named Default value Accept pipeline input? false Accept wildcard characters? false
<CommonParameters> This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable. For more information, type, "get-help about_commonparameters".
INPUT TYPE String
RETURN TYPE
NOTES
Copy-Item is like the 'cp' or 'copy' commands in other shells.
For more information, type "Get-Help Copy-Item -detailed". For technical information, type "Get-Help Copy-Item -full".
When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".
----------------- EXAMPLE 1 -----------------
C:\PS>copy-item C:\Wabash\Logfiles\mar1604.log.txt -destination C:\Presentation
This command will copy the file mar1604.log.txt to the C:\Presentation directory. The command does not delete the original file.
-------------------------- EXAMPLE 2 -----------------
C:\PS>copy-item C:\Logfiles -destination C:\Drawings -recurse
This command copies the entire contents of the Logfiles directory into the Drawings directory. If the source directory contains files in subdirectories, those subdirectories will be copied with their file trees intact. The -container parameter is set to true by default. This preserves the directory structure.
None.
----------------- EXAMPLE 3 -----------------
C:\PS>copy-item C:\Logfiles -destination C:\Drawings\Logs -recurse
This command copies the contents of the C:\Logfiles directory to the C:\Drawings\Logs directory. It will create the subdirectory \Logs if it does not already exist.
RELATED LINKS Clear-Item Get-Item Invoke-Item Move-Item Set-Item New-Item Remove-Item Rename-Item about_namespace
Last update: 03-09-2007 23:35
Users' Comments (0)
|
|
|