如何抑制wmic的输出

3

有人知道如何从以下命令中抑制消息“没有可用的实例。”吗?非常感谢您的帮助!

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

0

你有两个选择可以放置2>nul,要么

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

或者你可以这样做

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

0

你也可以将 stderr 导入 stdout,使其对 findstr 命令可见(从而忽略由于过滤器而导致的“无可用实例”):

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接