How to Use the Windows 11 Get-ChildItem Command in PowerShell

When navigating directories in the Windows 11 terminal, many users rely on the legacy DOS command dir or the Linux equivalent ls. While these commands technically work in PowerShell (acting as aliases), they do not unlock the true object-oriented power of the environment.

The native PowerShell cmdlet for listing files and folders is Get-ChildItem. Unlike legacy commands that simply spit out raw text, Get-ChildItem outputs rich, manipulatable data objects. This allows system administrators to easily filter massive directories, find massive hidden files, or isolate files modified on specific dates.

In this guide, you will learn how to use Get-ChildItem to perform advanced file searches in Windows 11.

Step 1: The Basic List Command

To see the contents of your current directory, open PowerShell and simply type:

Get-ChildItem

You will see a formatted table detailing the Mode (attributes like Read-Only or Directory), LastWriteTime, Length (file size in bytes), and Name of the items.

To list the contents of a specific folder without navigating to it, provide the path:

Get-ChildItem -Path "C:\Users\Public\Downloads"

Step 2: Finding Specific File Types

If a folder contains thousands of files and you only care about finding PDF documents, you can use the -Filter parameter.

Get-ChildItem -Path "C:\Documents" -Filter "*.pdf"

The asterisk (*) acts as a wildcard, telling PowerShell to return any file name as long as it ends in the .pdf extension.

Step 3: Performing Recursive Searches

By default, the command only looks at the top level of the folder you specify. If you want to search through every subfolder inside that directory (a recursive search), you must append the -Recurse switch.

Get-ChildItem -Path "C:\Users" -Filter "*.mp4" -Recurse

This command is incredibly powerful for hunting down large media files buried deep inside a user’s profile.

Step 4: Filtering by File Attributes (Hidden Files)

Windows hides crucial system files by default to prevent accidental deletion. To force Get-ChildItem to reveal these hidden files, use the -Force or -Hidden parameters.

To see only the hidden files in the root C:\ drive:

Get-ChildItem -Path "C:\" -Hidden

To see all files (both normal and hidden) together:

Get-ChildItem -Path "C:\" -Force

Step 5: Advanced Filtering (Piping to Where-Object)

Because Get-ChildItem outputs objects, you can pipe those objects into other PowerShell commands to create highly specific queries.

Suppose you are trying to free up hard drive space, and you want to find every single file on the C: drive that is larger than 1 Gigabyte.

Get-ChildItem -Path "C:\" -Recurse -File -ErrorAction SilentlyContinue | Where-Object {$_.Length -gt 1GB}

Here is what this complex command does:

  • -File: Ignores folders and only returns actual files.
  • -ErrorAction SilentlyContinue: Suppresses the “Access Denied” errors that occur when PowerShell tries to scan locked system directories.
  • Where-Object {$_.Length -gt 1GB}: Takes every file found and checks if its “Length” property is greater than (-gt) 1 Gigabyte.

Mastering Get-ChildItem is the first step toward automating complex file management tasks in Windows 11.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.