我正在尝试根据以下语句的输出执行操作:
wmic process where name="test.exe" | find "test.exe" /c
if the output is <=2 do echo two or less
if the output is >2 do echo more than two如何做到这一点呢?
发布于 2011-06-16 02:57:27
将它们设置为变量,然后进行比较,您还需要在搜索字符串=D之前使用开关
FOR /F "tokens=2 USEBACKQ delims=:" %%F IN (`command ^| find /C "test.exe"`) DO (
SET var=%%F
)
IF %var% LEQ 2 ECHO Two or Less
IF %var% GTR 2 ECHO More than Two编辑:(对于Jeb <3)
FOR /F "tokens=2 USEBACKQ delims=:" %%F IN (`command ^| find /C "test.exe"`) DO (
SET var=%%F
)
IF %var% LEQ 2 (
ECHO Two or Less
) ELSE (
ECHO More than Two
)https://stackoverflow.com/questions/6359306
复制相似问题