Powershell IF
Zur Navigation springen
Zur Suche springen
Einfache IF Verzweigung
$x = $($args[0])
$y = 10
if ($x -gt $y)
{
"$x is greater than $y"
}
IF mit ELSE
$x = $($args[0])
$y = 20
if ($x -gt $y)
{
"$x is greater than $y"
} else {
"$x is less than $y"
}
IF mit ELSE und ELSEIF
$x = $($args[0])
if ($x -eq 20)
{
!$x is 20!
} elseif ($x -eq 15)
{
"$x is 15"
} elseif ($x -eq 10)
{
"$x is 10"
} else
{
"Value of $x not known"
}