I'm trying to read out parameters out of a ps1-file with a Powershell script. (Run with powershell inputfile.ps1 which is calling evaluation.ps1) The input file looks like this:
$a=5
$b=""
$c=
$d=555
Unfortunately it's seems impossible to detect the not existing variable 'c' with the conventional methods e.g., $null
, -eq ""
,''
, -is [string]
or similar methods. This ends up that my Powershell script automatically uses the next value from variable 'd'. So in the end I get this information:
echo "$a"
5
echo "$b"
echo "$c"
555
echo "$d"
555
Is there any possibility to avoid using the value from next line or somehow detect a missing input? Unfortunately the ps1-input file should not be touched (I know when using an empty string as input like b="", all the above mentioned methods work fine).
Thanks for any help in advance.
I guess I tried all hints out of stackoverflow already here but since it's not a string but an empty input nothing works.