[PowerShell] ポート番号を指定してpingする

ポート番号を指定してpingしたい時は、PowerShellを使えば可能です。

手順

①PowerShellを起動する

PowerShellを使用します。起動方法は以下記事をご覧ください。
[Windows] PowerShellを起動する

②以下コマンドをPowerShellで実行する

(構文)
Test-NetConnection <IPアドレス> -port <ポート番号>

192.168.1.10の8080ポートに対してpingしたい場合は以下のようになります。

Windows PowerShell
PS C:¥> Test-NetConnection 192.168.1.10 -port 8080 ComputerName : 192.168.1.10 RemoteAddress : 192.168.1.10 RemortPort : 8080 InterfaceAlias : イーサネット SourceAddress : 192.168.1.1 TcpTestSucceeded : True

TcpTestSucceededがTrueなのでping成功です。

備考

  • ping結果は、TcpTestSucceededの値で判断できます。
    True →成功 False →失敗

関連記事


スポンサーリンク

PowerShell

Posted by tora