header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Setting Default parameters in Comment Based Help (V2)
Last Post 29 Sep 2009 01:07 PM by stangm. 0 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
stangmUser is Offline
New Member
New Member
Posts:2
Avatar

--
29 Sep 2009 01:07 PM
    When using comment based help, the system autogenerates parameter information from the parameters specified in the param statement.  However, it does not give the default value if one is specified.  For example, take the following snippet.
    ---------------------
    <#
     .SYNOPSIS
    Test

     .DESCRIPTION
    Test
     
    .PARAMETER Overwrite
     If present, specifies to overwrite the file

     .PARAMETER InputFile
     Specifies the path for the folder and file used for Input

     .PARAMETER OutputFile
     Specifies the path for the folder and file used for Output

    #>

    param(
        [switch] $overwrite=$false,
        [String] $Inputfile="C:\Foo.txt",
        [String] $OutputFile="C:\Bar.txt"
        )
    ---------------------------


    If you use get-help -full on this code you get

    ---------------------------
    PARAMETERS
        -overwrite []
            If present, specifies to overwrite the file

            Required?                    false
            Position?                    named
            Default value
            Accept pipeline input?       false
            Accept wildcard characters?

        -Inputfile
            Specifies the path for the folder and file used for Input

            Required?                    false
            Position?                    1
            Default value
            Accept pipeline input?       false
            Accept wildcard characters?

        -OutputFile
            Specifies the path for the folder and file used for Output

            Required?                    false
            Position?                    2
            Default value
            Accept pipeline input?       false
            Accept wildcard characters?
    ---------------------------


    Why no default value?  How do you get the help to show the default value?

    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer