![]() \PowerShellParameter.ps1 -StringParameter "Text" -BooleanParameter $True See an execution of the script above and its output: If you use switch the variable is “true” as soon as the parameter is added (you can use “-SwitchParameter” instead of “-SwitchParameter:$True”). Instead of the data type boolean you can also use switch. If you call the script and add a parameter the corresponding default value is overwritten. You can also define default values (lines 4 and 5 in the example script). Several parameters are defined with a comma between them, there is no comma after the last one. ![]() ![]() # output of the parameter values Write-host "StringParameter: $StringParameter" Write-host "BooleanParameter: $BooleanParameter" Write-host "IntegerParameter: $IntegerParameter" Write-host "SwitchParameter: $SwitchParameter"
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |