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

演算子
-and(&&)
使用例

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

#文字列
if(("ark" -eq "ARK") -and ("game.com" -eq "GAME.COM")){
      echo "result:test 456"	
}

実行結果
> .\test.ps1
result: test 123
result:test 456

PowerShell

Posted by arkgame