Supporting Wildcard Characters in Cmdlet Parameters

Welcome Forums General PowerShell Q&A Supporting Wildcard Characters in Cmdlet Parameters

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years ago.

  • Author
    Posts
  • #6073

    Member
    Points: 0
    Rank: Member

    by shureek at 2013-04-16 01:10:37

    Here is an example of cmdlet:
    [code2=powershell]function Get-MyFile {
    [CmdletBinding()]
    param(
    [String[]]$FileName
    )
    Get-ChildItem -Include $FileName
    }[/code2]

    How can I specify that $FileName parameter accepts wildcard character? I want help to contain following information:

    -FileName

    Required? false
    Position? Named
    Default value
    Accept pipeline input? false
    Accept wildcard characters? true

    like many standard cmdlets.

    by JeffH at 2013-04-16 05:06:40

    I don't think there's any way with an advanced function to have help detect this. I would add a note in comment based help for the parameter indicating it can accept wildcards.

The topic ‘Supporting Wildcard Characters in Cmdlet Parameters’ is closed to new replies.