![]() ValueFromPipeline – Accept values via the pipeline, of the same type expected by the parameter or that can be converted to the type that the parameter is expecting. Mandatory – Whether the parameter is mandatory or optional (the default) ![]() These affect the function parameters as follows: ![]() The params statement block can also optionally define parameter attributes: Let us take a look at the below examples to have a clear idea of command-line arguments in PowerShell script. The types can be anything like String, Int, etc and you also have the option to make the parameters mandatory. ![]() Syntax of Param Statement param($p1 =, $p2 =. The param statement must be the first executable line in the script with the only comment or empty lines preceding it. PowerShell comes up with a param statement that can be used at the beginning of the script. PowerShell provides an efficient way to pass command-line arguments by using parameters inside a PowerShell script.
0 Comments
Leave a Reply. |