Skip to content

Commit 7d50399

Browse files
bobbytreedsdwheeler
authored andcommitted
Fixes #2293 update yaml blocks (#4369)
1 parent cd1058b commit 7d50399

File tree

5 files changed

+344
-240
lines changed

5 files changed

+344
-240
lines changed

reference/3.0/Microsoft.PowerShell.Management/Copy-Item.md

Lines changed: 66 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
ms.date: 10/18/2018
2+
ms.date: 5/30/2019
33
schema: 2.0.0
44
locale: en-us
55
keywords: powershell,cmdlet
@@ -36,9 +36,9 @@ Copy-Item -LiteralPath <String[]> [[-Destination] <String>] [-Container] [-Force
3636
The `Copy-Item` cmdlet copies an item from one location to another location in the same namespace.
3737
For instance, it can copy a file to a folder, but it cannot copy a file to a certificate drive.
3838

39-
This cmdlet does not cut or delete the items being copied.
40-
The particular items that the cmdlet can copy depend on the PowerShell provider that exposes the item.
41-
For instance, it can copy files and directories in a file system drive and registry keys and entries in the registry drive.
39+
This cmdlet does not cut or delete the items being copied. The particular items that the cmdlet can
40+
copy depend on the PowerShell provider that exposes the item. For instance, it can copy files and
41+
directories in a file system drive and registry keys and entries in the registry drive.
4242

4343
This cmdlet can copy and rename items in the same command.
4444
To rename an item, enter the new name in the value of the **Destination** parameter.
@@ -48,7 +48,7 @@ To rename an item and not copy it, use the `Rename-Item` cmdlet.
4848

4949
### Example 1: Copy a file to the specified directory
5050

51-
This command copies the "mar1604.log.txt" file to the "C:\Presentation" directory.
51+
This command copies the `mar1604.log.txt` file to the `C:\Presentation` directory.
5252
The command does not delete the original file.
5353

5454
```powershell
@@ -58,17 +58,19 @@ Copy-Item "C:\Wabash\Logfiles\mar1604.log.txt" -Destination "C:\Presentation"
5858
### Example 2: Copy the contents of a directory to another directory
5959

6060
This command copies the entire contents of the "Logfiles" directory into the "Drawings" directory.
61-
If the "LogFiles" directory contains files in subdirectories, those subdirectories are copied with their file trees intact.
62-
The **Container** parameter is set to "true" by default.
63-
This preserves the directory structure.
6461

6562
```powershell
6663
Copy-Item "C:\Logfiles\*" -Destination "C:\Drawings" -Recurse
6764
```
6865

66+
If the "LogFiles" directory contains files in subdirectories, those subdirectories are copied with
67+
their file trees intact. The **Container** parameter is set to "true" by default.
68+
69+
This preserves the directory structure.
70+
6971
### Example 3: Copy the contents of a directory to another directory and create the destination directory if it does not exist
7072

71-
This command copies the contents of the "C:\Logfiles" directory to the "C:\Drawings\Logs" directory.
73+
This command copies the contents of the `C:\Logfiles` directory to the `C:\Drawings\Logs` directory.
7274
It creates the "\Logs" subdirectory if it does not already exist.
7375

7476
```powershell
@@ -77,25 +79,39 @@ Copy-Item C:\Logfiles -Destination C:\Drawings\Logs -Recurse
7779

7880
### Example 4: Copy a file to the specified directory and rename the file
7981

80-
This command uses the `Copy-Item` cmdlet to copy the "Get-Widget.ps1" script from the "\\\\Server01\Share" directory to the "\\\\Server12\ScriptArchive" directory.
81-
As part of the copy operation, the command also changes the item name from "Get-Widget.ps1" to "Get-Widget.ps1.txt", so it can be attached to email messages.
82+
This command uses the `Copy-Item` cmdlet to copy the `Get-Widget.ps1` script from the
83+
`\\Server01\Share` directory to the `\\Server12\ScriptArchive` directory.
84+
As part of the copy operation, the command also changes the item name from `Get-Widget.ps1` to
85+
`Get-Widget.ps1.txt`, so it can be attached to email messages.
8286

8387
```powershell
8488
Copy-Item "\\Server01\Share\Get-Widget.ps1" -Destination "\\Server12\ScriptArchive\Get-Widget.ps1.txt"
8589
```
8690

8791
## PARAMETERS
8892

89-
### -Credential
93+
### -Container
9094

91-
Specifies a user account that has permission to perform this action.
92-
The default is the current user.
95+
Indicates that this cmdlet preserves container objects during the copy operation.
9396

94-
Type a user name, such as "User01" or "Domain01\User01", or enter a **PSCredential** object, such as one generated by the `Get-Credential` cmdlet.
95-
If you type a user name, you are prompted for a password.
97+
```yaml
98+
Type: SwitchParameter
99+
Parameter Sets: (All)
100+
Aliases:
101+
102+
Required: False
103+
Position: Named
104+
Default value: True
105+
Accept pipeline input: False
106+
Accept wildcard characters: False
107+
```
108+
109+
### -Credential
96110
97-
> [!WARNING]
98-
> This parameter is not supported by any providers installed with Windows PowerShell.
111+
> [!NOTE]
112+
> This parameter is not supported by any providers installed with PowerShell.
113+
> To impersonate another user, or elevate your credentials when running this cmdlet,
114+
> use [Invoke-Command](../Microsoft.PowerShell.Core/Invoke-Command.md).
99115
100116
```yaml
101117
Type: PSCredential
@@ -112,7 +128,9 @@ Accept wildcard characters: False
112128
### -Destination
113129
114130
Specifies the path to the new location.
115-
To rename a copied item, include the new name in the value.
131+
The default is the current directory.
132+
133+
To rename the item being copied, specify a new name in the value of the **Destination** parameter.
116134
117135
```yaml
118136
Type: String
@@ -128,10 +146,11 @@ Accept wildcard characters: False
128146
129147
### -Exclude
130148
131-
Specifies, as a string array, an item or items that this cmdlet excludes from the operation.
132-
The value of this parameter qualifies the **Path** parameter.
133-
Enter a path element or pattern, such as "*.txt".
134-
Wildcard characters are permitted.
149+
Specifies, as a string array, an item or items that this cmdlet excludes in the operation. The value
150+
of this parameter qualifies the **Path** parameter. Enter a path element or pattern, such as
151+
`*.txt`. Wildcard characters are permitted. The **Exclude** parameter is effective only when the
152+
command includes the contents of an item, such as `C:\Windows\*`, where the wildcard character
153+
specifies the contents of the `C:\Windows` directory.
135154

136155
```yaml
137156
Type: String[]
@@ -147,11 +166,11 @@ Accept wildcard characters: True
147166

148167
### -Filter
149168

150-
Specifies a filter in the format or language of the provider.
151-
The value of this parameter qualifies the **Path** parameter.
152-
153-
The syntax of the filter, including the use of wildcard characters, depends on the provider.
154-
Filters are more efficient than other parameters, because the provider applies them when the cmdlet gets the objects rather than having PowerShell filter the objects after they are retrieved.
169+
Specifies a filter to qualify the **Path** parameter. The [FileSystem](../Microsoft.PowerShell.Core/About/about_FileSystem_Provider.md)
170+
provider is the only installed PowerShell provider that supports the use of filters. You can find
171+
the syntax for the **FileSystem** filter language in [about_Wildcards](../Microsoft.PowerShell.Core/About/about_Wildcards.md).
172+
Filters are more efficient than other parameters, because the provider applies them when the cmdlet
173+
gets the objects rather than having PowerShell filter the objects after they are retrieved.
155174

156175
```yaml
157176
Type: String
@@ -167,7 +186,8 @@ Accept wildcard characters: True
167186

168187
### -Force
169188

170-
Indicates that this cmdlet copies items that cannot otherwise be changed, such as copying over a read-only file or alias.
189+
Indicates that this cmdlet copies items that cannot otherwise be changed, such as copying over a
190+
read-only file or alias.
171191

172192
```yaml
173193
Type: SwitchParameter
@@ -176,17 +196,18 @@ Aliases:
176196
177197
Required: False
178198
Position: Named
179-
Default value: None
199+
Default value: False
180200
Accept pipeline input: False
181201
Accept wildcard characters: False
182202
```
183203

184204
### -Include
185205

186-
Specifies, as a string array, an item or items that this cmdlet includes in the operation.
187-
The value of this parameter qualifies the **Path** parameter.
188-
Enter a path element or pattern, such as "*.txt".
189-
Wildcard characters are permitted.
206+
Specifies, as a string array, an item or items that this cmdlet includes in the operation. The value
207+
of this parameter qualifies the **Path** parameter. Enter a path element or pattern, such as
208+
`"*.txt"`. Wildcard characters are permitted. The **Include** parameter is effective only when the
209+
command includes the contents of an item, such as `C:\Windows\*`, where the wildcard character
210+
specifies the contents of the `C:\Windows` directory.
190211

191212
```yaml
192213
Type: String[]
@@ -197,16 +218,17 @@ Required: False
197218
Position: Named
198219
Default value: None
199220
Accept pipeline input: False
200-
Accept wildcard characters: False
221+
Accept wildcard characters: True
201222
```
202223

203224
### -LiteralPath
204225

205-
Specifies a path to the item.
206-
Unlike the **Path** parameter, the value of **LiteralPath** is used exactly as it is typed.
207-
No characters are interpreted as wildcards.
208-
If the path includes escape characters, enclose it in single quotation marks.
209-
Single quotation marks tell PowerShell not to interpret any characters as escape sequences.
226+
Specifies a path to one or more locations. The value of **LiteralPath** is used exactly as it is
227+
typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose
228+
it in single quotation marks. Single quotation marks tell PowerShell not to interpret any characters
229+
as escape sequences.
230+
231+
For more information, see [about_Quoting_Rules](../Microsoft.Powershell.Core/About/about_Quoting_Rules.md).
210232

211233
```yaml
212234
Type: String[]
@@ -232,14 +254,15 @@ Aliases:
232254
233255
Required: False
234256
Position: Named
235-
Default value: None
257+
Default value: False
236258
Accept pipeline input: False
237259
Accept wildcard characters: False
238260
```
239261

240262
### -Path
241263

242264
Specifies, as a string array, the path to the items to copy.
265+
Wildcard characters are permitted.
243266

244267
```yaml
245268
Type: String[]
@@ -250,7 +273,7 @@ Required: True
250273
Position: 1
251274
Default value: None
252275
Accept pipeline input: True (ByPropertyName, ByValue)
253-
Accept wildcard characters: False
276+
Accept wildcard characters: True
254277
```
255278

256279
### -Recurse
@@ -264,7 +287,7 @@ Aliases:
264287
265288
Required: False
266289
Position: Named
267-
Default value: None
290+
Default value: False
268291
Accept pipeline input: False
269292
Accept wildcard characters: False
270293
```

0 commit comments

Comments
 (0)