New-Item -ItemType

This topic contains 7 replies, has 4 voices, and was last updated by  Greg Tate 1 year, 10 months ago.

  • Author
  • #38904

    Greg Tate

    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.

  • #38907

    Liam Kemp

    Hey Greg,
    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.


  • #38909

    Paul Frankovich

    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.

  • #38922

    Greg Tate

    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.

  • #38926

    Paul Frankovich

    That only works in the ISE, but it is a good start.

  • #38927

    Greg Tate

    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

  • #38931

    Don Jones

    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.

  • #38934

    Greg Tate

    Again, appreciate the replies everyone!

You must be logged in to reply to this topic.