3

Does anyone know how to suppress the msg "No Instance(s) Available." from the following command? Your help is highly appreciated in advance!

wmic process where (name="java.exe") get commandline | findstr /i /c:"xxx" 1>nul 2>&1
Andriy M
  • 76,112
  • 17
  • 94
  • 154
Tracy
  • 31
  • 1
  • 2

2 Answers2

0

You can also pipe stderr into stdout making it visible for your findstr command (thus ignoring "No Instance(s) Available." due to your filter):

wmic process where (name="java.exe") get commandline 2>&1 | findstr /i /c:"xxx"
Konrad Holl
  • 616
  • 5
  • 12
0

You have 2 choices where to place the 2>nul, either

2>nul wmic process where (name="java.exe") get commandline | findstr /i /c:"xxx"

or you can do

wmic process where (name="java.exe") get commandline 2>nul | findstr /i /c:"xxx"
wimh
  • 15,072
  • 6
  • 47
  • 98