if statement - Adding string to variable powershell -
i trying create powershell script append character variable if variable not null. instance user fills out form, or spreadsheet cell in case , has data want append | variable when call variable in script display | contents of variable. have , not seem working.
if ([string]::isnullorempty($field6)) {$field6 = $field6} else {$field6 = "| $field6" } } echo $field6
this should suffice:
if ($field6 -ne $null) { $field6 = "| $field6" }
Comments
Post a Comment