开发者

How to suppress the output of wmic

开发者 https://www.devze.com 2023-03-22 05:11 出处:网络
Does anyone know how to suppress the msg \"No Instance(s) Available.\" from the following command? Your help is highly apprecia开发者_运维技巧ted in advance!

Does anyone know how to suppress the msg "No Instance(s) Available." from the following command? Your help is highly apprecia开发者_运维技巧ted in advance!

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


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"


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"
0

精彩评论

暂无评论...
验证码 换一张
取 消