Why does ChildItem behave like Get-ChildItem?

Hi, could someone explain why nouns behave like implicit aliases for their corresponding cmdlet where the verb is ‘get’?

These give the same output:

ChildItem & Get-ChildItem
Location & Get-Location

This works for almost any noun where it also inside a cmdlet that has the get verb as the prefix. And the output is always the same as if it was an alias for get-noun

However this doesn’t work for all. Just as process is not being evaluated as get-process.

I did wonder if they were aliases but they don’t reveal themselves to be.

I wonder if someone could explain this. Thanks.

Ok. This is implicit behavior apparantly. Could be better documented.

That’s a fun on! Normally, I would have told you to look at Get-Help or Get-Alias, but those aren’t listed as aliases for the cmdlets they execute. And I can’t seem to find anything that explains what is going on here! They’re definitely acting like an alias, but I don’t know where it would be documented…

Get-Help Get-ChildItem
Get-Alias -Definition Get-ChildItem

Learned something new :grinning:
Looking at this Git issue. It appears they refer to it as ‘default verb logic’.

When no verb is specified Get is implied. This makes sense since cmdlets with get are non-data altering or the most safe to run.

There does not appear to be any built-in help documentation about this.

1 Like

yea, I really struggled to find any info on it, then I gave up searching :smiley:

I also recall this coming up in another thread, around help, which happens to ben actual function and isn’t the same thing. help actually pipes help to the more command (basically lets you look at help a page at a time)

For everything else, I suggest avoiding using this. it’s essentially, as far as I can tell, an undocumented feature.