Reputation: 83
I want to output the parameters of a function in powershell, but it is displayed the result of the parameters in one single line, so the $VariableHere2 cannot be displayed properly. How do I catch only the $VariableHere2 ?
Function Get-Something {
Param([string]$VariableHere,[string]$VariableHere2)
Write-Output "My variable 1 is $VariableHere"
Write-Output "My variable 2 is $VariableHere2"}
$VariableHere = "test1"
$VariableHere2 = "test2"
Get-Something($VariableHere,$VariableHere2)
Upvotes: 0
Views: 382
Reputation: 6860
when calling the function dont use '()' and dont use commas ',' . '(stuff here)' is a mark of new code or data that should be gathered or Run together before the request. The correct way would be....
Get-Something $VariableHere $VariableHere2
OR
Get-Something -VariableHere $VariableHere -VariableHere2 $VariableHere2
Upvotes: 1