「PowerShell入門」論理演算子-orを使うサンプル

説明
-or(||)
使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#数値
if((30 -gt 20) -or (-50 -lt -14)){
echo "-or result: test AAA"
}
#文字列
if(("ark11" -eq "ARK") -or ("game.com" -eq "GAME.COM")){
echo "-or result:test BBB"
}
#数値 if((30 -gt 20) -or (-50 -lt -14)){ echo "-or result: test AAA" } #文字列 if(("ark11" -eq "ARK") -or ("game.com" -eq "GAME.COM")){ echo "-or result:test BBB" }
#数値
if((30 -gt 20) -or (-50 -lt -14)){
      echo "-or result: test AAA"	
}

#文字列
if(("ark11" -eq "ARK") -or ("game.com" -eq "GAME.COM")){
      echo "-or result:test BBB"	
}

実行結果
> .\test.ps1
-or result: test AAA
-or result:test BBB

PowerShell

Posted by arkgame