Tagged: filesystem provider ItemType
May 10, 2016 at 4:41 pm #38904
How can I get a full list of values for the -ItemType parameter in New-Item?
I realize that directory and file are acceptable values for the filesystem provider. But where in the help can I confirm this information? Or what command can I run to show it.
May 10, 2016 at 7:09 pm #38907
That's a good question, i'm not too sure about how to automatically/quickly get a list of values for a parameter. But in this case, its a short list so tabbing through works ok.
SymbolicLink – I think this is V 5 only
I'd be interested to know if there was an easy way to pull this from powershell though.
May 10, 2016 at 8:39 pm #38909
If it were an Enum you could easily pull the list but I think Liam points out the only way to find something that appears to just be a ValidateSet.
May 11, 2016 at 3:52 am #38922
Thanks for the response guys.
The tab option is a sufficient enough workaround to satisfy my curiosity.
This question was asked five years ago on the TechNet forums:
A feature request was filed on connect here:
There was a response in January indicating you can also press CTRL+spacebar to retrieve a list of possible values. This is new in PowerShell 5.
May 11, 2016 at 4:22 am #38926
That only works in the ISE, but it is a good start.
May 11, 2016 at 4:28 am #38927
I find that it works in the shell as well, at least on 1511.
Give it a try and see:
New-item c:\newitem.txt -ItemType CTRL+spacebar
May 11, 2016 at 4:58 am #38931
The thing is that New-Item is largely dynamic. What values are valid depends on the PSDrive you're in at the time. So there's no static enumeration. The command does expose tab completion, but it's dependent on the PSProvider providing the valid values. Some will, some won't.
May 11, 2016 at 5:30 am #38934
Again, appreciate the replies everyone!
You must be logged in to reply to this topic.