天天看點

Windows使用正規表達式檢視端口

<a href="https://s3.51cto.com/wyfs02/M01/08/45/wKiom1ne2x-jb73JAAOQElXOKj8977.jpg" target="_blank"></a>

netstat --help#擷取幫助

netstat -an &gt; c:\aaa.txt #将顯示的結果輸入到C槽aaa.txt檔案中

netstat -ano | find “443”#檢視443端口

<a href="https://s3.51cto.com/wyfs02/M00/08/44/wKiom1ne0l7j2dUlAAEmJFFbWFI303.jpg" target="_blank"></a>

@echo off

netstat -an &gt; c:\t.txt #在C槽建立檔案名為t.txt

type c:\t.txt | find ":21" &gt; tmp.txt &amp;&amp; echo "ftp is running...."

type c:\t.txt | find ":80" &gt; tmp.txt &amp;&amp; echo "http is running...."

pause

type c:\t.txt | find ":123" &gt; tmp.txt &amp;&amp; echo "hehe is running...."

del c:\t.txt

::這是我試驗用于檢測各項服務是否開啟

本文轉自 周小玉 51CTO部落格,原文連結:http://blog.51cto.com/maguangjie/1971626,如需轉載請自行聯系原作者

繼續閱讀