Scripting Netstat批处理程序

Scripting Netstat批处理程序,scripting,batch-file,Scripting,Batch File,运行此批处理脚本时,结果始终相同。我相信我在语法上遗漏了一些东西。我错过了什么 @echo off netstat -an | find /C "LIST" > tmpFile set test=<tmpFile del tmpFile set max=6 IF !%test! GTR !max! echo Greater than X IF !%test! LEQ !max! echo Less than X PAUSE :EOF @echo关闭 netstat-一个| find

运行此批处理脚本时,结果始终相同。我相信我在语法上遗漏了一些东西。我错过了什么

@echo off
netstat -an | find /C "LIST" > tmpFile
set test=<tmpFile
del tmpFile
set max=6
IF !%test! GTR !max! echo Greater than X
IF !%test! LEQ !max! echo Less than X
PAUSE
:EOF
@echo关闭
netstat-一个| find/C“列表”>tmpFile
设置test=
@echo关闭
setlocal EnableDelayedExpansion
netstat-一个| find/C“列表”>tmpFile
设置/设置测试=
@echo off
setlocal EnableDelayedExpansion

netstat -an | find /C "LIST" > tmpFile
set /P test=<tmpFile
del tmpFile
set max=20
IF !test! GTR !max! echo Greater than X
IF !test! LEQ !max! echo Less than X
PAUSE
:EOF