Miles Hayler
Miles Hayler

Reputation: 113

How do I not echo WMIC in a batch file

I am running the below command as part of a logon script, and would like to make sure the result isn't echoed:

wmic qfe | find "3033929"

I tried placing an @ before the line but don't really know what else to try.

Thanks

Upvotes: 0

Views: 741

Answers (2)

Magoo
Magoo

Reputation: 79983

Prefixing with @ tells cmd not to echo the command before executing it.

wmic qfe | find "3033929" >nul

sends the output of the find to nowhere. errorlevel will still be set (0=found, non-0=not found)

Upvotes: 1

vmachan
vmachan

Reputation: 1682

You can use the below option for wmic to suppress output from wmic

wmic /output:CLIPBOARD qfe

But then your find would not work since it won't get any input.

I think you need to re-direct the output of the whole command as shown below to a file so that nothing is echoed to the screen/console

wmic qfe | find "3033929" > wmic.out 

You can then look at wmic.out for the results

Upvotes: 0

Related Questions