Skip to main content

Command referenceGet-ChildItem

Get-ChildItem command (Windows / PowerShell)

WindowsPowerShellfilebeginner

What it does

Enumerate items and child items in filesystem, registry, and other providers. Guides covering the get-childitem powershell usually need pipeline-friendly examples, common parameters, and how the cmdlet compares with classic CMD or Linux tools. This page includes syntax, options, and copyable PowerShell examples.

Enumerate items and child items in filesystem, registry, and other providers.

Syntax

Get-ChildItem [[-Path] <String[]>] [-Filter <String>] [-Recurse] [-File] [-Directory] [-Force]

Common options

Flag / optionMeaning
-PathSelect one or more provider paths.
-RecurseEnumerate descendants.
-FileReturn files only in the filesystem provider.
-DirectoryReturn directories only.
-ForceInclude hidden and protected items.

Practical examples

List hidden items

Get-ChildItem -Force

Includes normally hidden entries.

Find logs

Get-ChildItem C:\Logs -Filter *.log -Recurse -File

Recursively returns log files.

Largest files

Get-ChildItem . -File | Sort-Object Length -Descending | Select-Object -First 10

Selects the ten largest files.

Linux ↔ Windows equivalent

Closest match: ls (Linux / bash / sh / zsh). List directory entries and inspect file metadata.

Common mistakes

  • Using `-Include` without a wildcard path or recursion and receiving unexpected results.
  • Forgetting `-Force` when hidden items matter.

FAQ

What does Get-ChildItem do in PowerShell?

Enumerate items and child items in filesystem, registry, and other providers.

How can I see examples for Get-ChildItem?

Run `Get-Help Get-ChildItem -Examples`, then adapt an example to the provider and objects you are using.

What is a practical Get-ChildItem example?

Try `Get-ChildItem -Force` — Includes normally hidden entries.

Does Get-ChildItem return text or objects?

Get-ChildItem normally participates in PowerShell's object pipeline; formatting seen in the console is a view of those objects.

Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.