HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

Get-ChildItem — List items in a directory. Note: This command can only be used through PowerShell. More information:

Submitted by: @import:tldr-pages··
0
Viewed 0 times
directorycommandnotethiscliget-childitemitemslist
windows

Problem

How to use the Get-ChildItem command: List items in a directory. Note: This command can only be used through PowerShell. More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/get-childitem>.

Solution

Get-ChildItem — List items in a directory. Note: This command can only be used through PowerShell. More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.management/get-childitem>.

List all non-hidden items in the current directory:
Get-ChildItem


List only directories in the current directory:
Get-ChildItem -Directory


List only files in the current directory:
Get-ChildItem -File


List items in the current directory, including hidden items:
Get-ChildItem -Hidden


List items in a directory other than the current one:
Get-ChildItem -Path {{path\to\directory}}

Code Snippets

List all non-hidden items in the current directory

Get-ChildItem

List only directories in the current directory

Get-ChildItem -Directory

List only files in the current directory

Get-ChildItem -File

List items in the current directory, including hidden items

Get-ChildItem -Hidden

List items in a directory other than the current one

Get-ChildItem -Path {{path\to\directory}}

Context

tldr-pages: windows/Get-ChildItem

Revisions (0)

No revisions yet.