Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Get-ChildItem IncludeRoot Parameter

Open
#244 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
powershell
Domain
cli

Research direction

Start with the RFC text and the linked examples to understand the requested Get-ChildItem workflow. Review the current -Recurse behavior and the proposed IncludeRoot parameter and output. Done means the RFC's parameter, usage example, output, and design considerations are resolved well enough for implementation.

Written by the indexing model from the issue text.

Description


RFC:
Author: John Bevan
Status: Draft
SupercededBy:
Version:
Area: Standard Functions
Comments Due:
Plan to implement:

Get-ChildItem; Add IncludeRoot Switch

Suggestion: Currently if you wish to fetch an item and its children you have to make a call to Get-Item and Get-ChildItem. Since this is a common use case, it would be good to reduce this to a single call. By adding an IncludeRoot switch to Get-ChildItem we could easily have it fulfill this requirement.

Here are some examples of people who've hit this scenario & tried to get creative in resolving it.

Motivation

As a PowerShell user,
I can retrieve an item and its children,
so that I have the full tree returned in a single result set.

User Experience

Example of user experience with example code/script.
Include example of input and output.

Get-ChildItem -Path 'c:\demo' -IncludeRoot -Recurse | Select-Object -ExpandProperty FullName
c:\demo
c:\demo\subfolder
c:\demo\subfolder\one.txt
c:\demo\subfolder\two.txt

Specification

Include [Parameter()][Switch]$IncludeRoot in the list of available parameters.

Alternate Proposals and Considerations

The current workaround is to make separate calls to Get-Item and Get-ChildItem.

Dominant language
PowerShell
Stars
468
Forks
143
Avg merge
9m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PowerShell/PowerShell-RFC

All issues in PowerShell/PowerShell-RFC

Similar issues

More CLI issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.