I am tryin开发者_开发知识库g to perform an action depending on this statements output:
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
How could this be achieved?
set them to variables then compare also you want switches before the search string =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
EDIT: (for 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
)
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论