
CODE: [Copy to clipboard]@echo off
for /f "tokens=1,2" %%i in ('netstat -an -p TCP^|find "80"') do @echo %%j
pause
CODE: [Copy to clipboard]@echo off
for /f "tokens=1,2" %%i in ('netstat -an -p TCP^|find ":80"') do @echo %%j
pause
CODE: [Copy to clipboard]Set Ws=CreateObject("WScript.Shell")
Set oExec=ws.Exec("%comspec% /c netstat -an -p TCP")
s=oExec.StdOut.ReadAll
wscript.echo re(s)
function re(a)
set regex=new regexp
regex.pattern=":[1-9][\d]{1,4}"
regex.global=true
set matchs=regex.execute(a)
for each match in matchs
m=replace(match,":","")
if instr(re,m)=0 then
re=re & m & vbcrlf
end if
next
end function
CODE: [Copy to clipboard][ Last edited by 26933062 on 2009-4-25 at 08:26 ]@echo off
for /f "tokens=1-2 delims= " %%a in ('netstat -an -p TCP') do (
if defined flag set "ip=%%b"&set "flag="
if /i "%%b %%c"=="Local Address" set flag=a
)
echo %ip%
pause
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |