Powershell Scripting Tutorial
Introduction Tools required for Powershell First Powershell script Interacting with userSpecial characters in Windows Powershell scriptingArrays String manipulation Conditional statements Looping statements Passing arguments Passing named arguments Exit status of the script Writing functionsConditional statements in windows powershell scripting
There are 2 types of conditional statements in Powershell.- if …. else
- switch
if…..else statement
Here is an example on if…else statement.
$a=11
if ($a%2 -eq 0)
{
echo “a is even”
}
else
{
echo “a is odd”
}
switch statement
Here is an example on switch statement.
$a=2
switch ($a)
{
1 {echo “case 1”}
2 {echo “case 2”}
default {echo “default case”}
}
Web development and Automation testing
solutions delivered!!