Difference between revisions of "The "if" statement"
From MyWiki
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <source lang=" | + | <source lang="powershell"> |
Get-Help about_if<br> | Get-Help about_if<br> | ||
− | if ($a -gt 2) | + | if ($a -gt 2) |
{<br> | {<br> | ||
− | Write-Host "The value $a is greater than 2." | + | Write-Host "The value $a is greater than 2." |
}<br> | }<br> | ||
+ | |||
+ | ########################### | ||
+ | |||
+ | $dow = (get-date).dayofweek | ||
+ | |||
+ | If (($dow -ne "Saturday") -or ($dow -ne "Sunday")) | ||
+ | { | ||
+ | //Run Script | ||
+ | } | ||
+ | Else | ||
+ | { | ||
+ | //Do not run Script | ||
+ | } | ||
+ | |||
+ | ########################## | ||
+ | $dow = (get-date).dayofweek | ||
+ | If (($dow -ne "Saturday") -and ($dow -ne "Sunday")) | ||
+ | { | ||
+ | //Run Script | ||
+ | } | ||
+ | Else | ||
+ | { | ||
+ | //Do not run Script | ||
+ | } | ||
+ | |||
</source> | </source> |
Latest revision as of 07:00, 13 August 2015
Get-Help about_if<br> if ($a -gt 2) {<br> Write-Host "The value $a is greater than 2." }<br> ########################### $dow = (get-date).dayofweek If (($dow -ne "Saturday") -or ($dow -ne "Sunday")) { //Run Script } Else { //Do not run Script } ########################## $dow = (get-date).dayofweek If (($dow -ne "Saturday") -and ($dow -ne "Sunday")) { //Run Script } Else { //Do not run Script }