You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -76,21 +76,21 @@ This command lists the .txt files in the Logs subdirectory, except for those who
76
76
It uses the wildcard character (`*`) to indicate the contents of the Logs subdirectory, not the directory container.
77
77
Because the command does not include the `-Recurse` parameter, `Get-ChildItem` does not include the content of directory automatically; you need to specify it.
78
78
79
-
### Example 4
79
+
### Example 4: Get all registry keys in a specific key
80
80
```powershell
81
81
Get-ChildItem -Path HKLM:\Software
82
82
```
83
83
84
84
This command gets all of the registry keys in the HKEY_LOCAL_MACHINE\SOFTWARE key in the registry of the local computer.
85
85
86
-
### Example 5
86
+
### Example 5: Get the name of items in the current directory
87
87
```powershell
88
88
Get-ChildItem -Name
89
89
```
90
90
91
91
This command gets only the names of items in the current directory.
92
92
93
-
### Example 6
93
+
### Example 6: Get all certificates in a certification drive that have code-signing authority
@@ -109,13 +109,20 @@ This parameter gets only certificates that have code-signing authority.
109
109
110
110
For more information about the Certificate provider and the Cert: drive, go to [Certificate Provider](../../Microsoft.PowerShell.Security/Providers/certificate-provider.md) or use the `Update-Help` cmdlet to download the help files for the Microsoft.PowerShell.Security module and then type `Get-Help Certificate`.
111
111
112
-
### Example 7
112
+
### Example 7: Get all items in the specified directory and its subdirectories that have an inclusion and exclusion
This command gets all of the items in the C:\Windows directory and its subdirectories that have "mouse" in the file name, except for those with a .png file name extension.
118
118
119
+
### Example 8: Get all items in the specified directory and its subdirectories limited by the Depth parameter
120
+
```
121
+
PS C:\> Get-ChildItem -Path C:\Windows -Depth 2
122
+
```
123
+
124
+
This command gets all of the items in the C:\Windows directory and its subdirectories up to 2 level below in depth.
To get only directories, use the `-Directory` parameter and omit the `-File` parameter. To exclude directories, use the `-File` parameter and omit the `-Directory` parameter, or use the `-Attributes` parameter.
178
-
179
-
To get directories, use the Directory parameter, its "`ad`" alias, or the Directory attribute of the `-Attributes` parameter.
181
+
### -Depth
182
+
This parameter, added in Powershell 5.0 enables you to control the depth of recursion. You use both the `-Recurse` and the `-Depth` parameter to limit the recursion.
To get only files, use the `-File` parameter and omit the Directory parameter. To exclude files, use the `-Directory` parameter and omit the `-File` parameter, or use the `-Attributes` parameter.
199
+
To get only directories, use the `-Directory` parameter and omit the `-File` parameter. To exclude directories, use the `-File` parameter and omit the `-Directory` parameter, or use the `-Attributes` parameter.
197
200
198
-
To get files, use the File parameter, its "`af`" alias, or the File value of the `-Attributes` parameter.
201
+
To get directories, use the Directory parameter, its "`ad`" alias, or the Directory attribute of the `-Attributes` parameter.
Gets only hidden files and directories (folders). By default, `Get-ChildItem` gets only non-hidden items, but you can use the `-Force` parameter to include hidden items in the results.
214
-
215
-
To get only hidden items, use the `-Hidden` parameter, its "`h`" or "`ah`" aliases, or the Hidden value of the `-Attributes` parameter. To exclude hidden items, omit the `-Hidden` parameter or use the `-Attributes` parameter.
215
+
### -Exclude
216
+
Omits the specified items.
217
+
The value of this parameter qualifies the `-Path` parameter.
218
+
Enter a path element or pattern, such as "*.txt".
219
+
Wildcards are permitted.
216
220
217
221
```yaml
218
-
Type: SwitchParameter
222
+
Type: String[]
219
223
Parameter Sets: (All)
220
-
Aliases: ah, h
224
+
Aliases:
221
225
222
226
Required: False
223
227
Position: Named
224
228
Default value: None
225
229
Accept pipeline input: False
226
-
Accept wildcard characters: False
230
+
Accept wildcard characters: True
227
231
```
228
232
229
-
### -ReadOnly
230
-
Gets only read-only files and directories (folders).
233
+
### -File
234
+
Gets files.
231
235
232
-
To get only read-only items, use the `-ReadOnly` parameter, its "`ar`" alias, or the ReadOnly value of the `-Attributes` parameter. To exclude read-only items, use the `-Attributes` parameter.
236
+
To get only files, use the `-File` parameter and omit the Directory parameter. To exclude files, use the `-Directory` parameter and omit the `-File` parameter, or use the `-Attributes` parameter.
237
+
238
+
To get files, use the File parameter, its "`af`" alias, or the File value of the `-Attributes` parameter.
To get only system files and folders, use the `-System` parameter, its "`as`" alias, or the System value of the `-Attributes` parameter. To exclude system files and folders, use the `-Attributes` parameter.
252
+
### -Filter
253
+
Specifies a filter in the provider's format or language.
254
+
The value of this parameter qualifies the `-Path` parameter.
255
+
The syntax of the filter, including the use of wildcards, depends on the provider.
256
+
Filters are more efficient than other parameters, because the provider applies them when retrieving the objects, rather than having Windows PowerShell filter the objects after they are retrieved.
This parameter is valid only when a transaction is in progress.
284
-
For more information, see about_Transactions.
285
-
286
-
```yaml
287
-
Type: SwitchParameter
288
-
Parameter Sets: (All)
289
-
Aliases: usetx
290
-
291
-
Required: False
292
-
Position: Named
293
-
Default value: False
294
-
Accept pipeline input: False
295
-
Accept wildcard characters: False
296
-
```
288
+
### -Hidden
289
+
Gets only hidden files and directories (folders). By default, `Get-ChildItem` gets only non-hidden items, but you can use the `-Force` parameter to include hidden items in the results.
297
290
298
-
### -Exclude
299
-
Omits the specified items.
300
-
The value of this parameter qualifies the `-Path` parameter.
301
-
Enter a path element or pattern, such as "*.txt".
302
-
Wildcards are permitted.
291
+
To get only hidden items, use the `-Hidden` parameter, its "`h`" or "`ah`" aliases, or the Hidden value of the `-Attributes` parameter. To exclude hidden items, omit the `-Hidden` parameter or use the `-Attributes` parameter.
303
292
304
293
```yaml
305
-
Type: String[]
294
+
Type: SwitchParameter
306
295
Parameter Sets: (All)
307
-
Aliases:
296
+
Aliases: ah, h
308
297
309
298
Required: False
310
299
Position: Named
311
300
Default value: None
312
301
Accept pipeline input: False
313
-
Accept wildcard characters: True
314
-
```
315
-
316
-
### -Filter
317
-
Specifies a filter in the provider's format or language.
318
-
The value of this parameter qualifies the `-Path` parameter.
319
-
The syntax of the filter, including the use of wildcards, depends on the provider.
320
-
Filters are more efficient than other parameters, because the provider applies them when retrieving the objects, rather than having Windows PowerShell filter the objects after they are retrieved.
Gets only read-only files and directories (folders).
379
+
380
+
To get only read-only items, use the `-ReadOnly` parameter, its "`ar`" alias, or the ReadOnly value of the `-Attributes` parameter. To exclude read-only items, use the `-Attributes` parameter.
381
+
382
+
```yaml
383
+
Type: SwitchParameter
384
+
Parameter Sets: (All)
385
+
Aliases: ar
386
+
387
+
Required: False
388
+
Position: Named
389
+
Default value: None
390
+
Accept pipeline input: False
391
+
Accept wildcard characters: False
392
+
```
393
+
406
394
### -Recurse
407
395
Gets the items in the specified locations and in all child items of the locations.
This parameter, added in Powershell 5.0 enables you to control the depth of recursion. You use both the `-Recurse` and the `-Depth` parameter to limit the recursion.
411
+
### -System
412
+
Gets only system files and directories (folders).
413
+
414
+
To get only system files and folders, use the `-System` parameter, its "`as`" alias, or the System value of the `-Attributes` parameter. To exclude system files and folders, use the `-Attributes` parameter.
425
415
426
416
```yaml
427
-
Type: UInt32
417
+
Type: SwitchParameter
428
418
Parameter Sets: (All)
429
-
Aliases:
419
+
Aliases: as
430
420
431
421
Required: False
432
422
Position: Named
@@ -435,6 +425,23 @@ Accept pipeline input: False
435
425
Accept wildcard characters: False
436
426
```
437
427
428
+
### -UseTransaction
429
+
Includes the command in the active transaction.
430
+
This parameter is valid only when a transaction is in progress.
431
+
For more information, see about_Transactions.
432
+
433
+
```yaml
434
+
Type: SwitchParameter
435
+
Parameter Sets: (All)
436
+
Aliases: usetx
437
+
438
+
Required: False
439
+
Position: Named
440
+
Default value: False
441
+
Accept pipeline input: False
442
+
Accept wildcard characters: False
443
+
```
444
+
438
445
### CommonParameters
439
446
This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVariable`, `-InformationAction`, `-InformationVariable`, `-OutVariable`, `-OutBuffer`, `-PipelineVariable`, `-Verbose`, `-WarningAction`, and `-WarningVariable`. For more information, see [about_CommonParameters](../../Microsoft.PowerShell.Core/about/about_CommonParameters.md).
0 commit comments