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?
|