Why can’t I autocomplete PSIsContainer in PowerShell?

0
4
Asked By CuriousCat42 On

I've been trying to get autocomplete suggestions for `PSIsContainer` while using PowerShell, but it seems like this property is hidden. Does anyone know why it might not be appearing in the completion list?

4 Answers

Answered By TechWizard88 On

It's just one of those properties marked as hidden. It exists on the object, but some contexts, like the Foreach-Object properties, don't show note properties added by providers. This is similar to how properties like PSPath and PSProvider work. They seem to be there mainly for cmdlets to handle objects seamlessly, regardless of how each provider names their items.

Answered By PowerUpDude On

I managed to get it to work by navigating to my desktop and using `Get-ChildItem`. When I accessed the property directly (like `$a[1].PSIsContainer`), it showed up for me. Are you trying it in a different way? What exactly are you doing that isn't working?

Answered By CoderDude01 On

The reason you're not seeing it is that `PSIsContainer` is a property added by the provider system, which the type inference doesn't seem to recognize. If you're interested in having this fixed, you might want to report it on GitHub.

Answered By MemeMaster2000 On

I noticed it doesn't autocomplete when you link it to an expression, like in `(gi .dir).psiscontainer`. Maybe that's a factor in your case?

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.