【PowerShell】PowershellのString型をBoolean型へ変換

true
という文字列を代入
1 2 3 4 5 6 7 |
$a = "true" $a.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True String System. Object |
[System.Convert]::ToBoolean($a)
でBooloan型へ変換
1 2 3 4 5 6 7 |
$TrueorFalse = [System.Convert]::ToBoolean($a) $TrueorFalse.GetType() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True Boolean System. ValueType |