Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

wmic query

Featured Replies

i'm trying to query my computer with multiple ... "searches"?

my first line is working,

wmic product where "name like 'java%'" get description

i also want to run this at the same time

wmic os get csname

so basically when i run the code, i'll get the computer name and java version at the same time, (it doesn't need to be formatted like that, but something close)

once i get it working, i can use the /node and run this against my entire network

CSName      Description
PC1             Java8 Update 111

any clues?

I don't understand.

Make a batch, get the CSName first, then get the Java version (or viceversa), then output these two pieces of info together.

However you will need some further "filtering" of the results, running "wmic product where "name like 'java%'" get description" produces:

Description
Java(TM) 6 Update 24
Java 8 Update 66
Java Auto Updater

on my machine.

The "base" should be more or less:
 

@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
FOR /F "USEBACKQ TOKENS=*" %%A IN (`WMIC PRODUCT WHERE "name like 'java%%'" GET DESCRIPTION /format:list^|FIND "="`) DO ECHO my%%A 
FOR /F "TOKENS=*" %%A IN ('WMIC OS GET CSNAME /format:list^|FIND "="') DO ECHO my%%A

FOR /F "USEBACKQ TOKENS=2 DELIMS==" %%A IN (`WMIC PRODUCT WHERE "name like 'java%%'" GET DESCRIPTION /format:list^|FIND "="`) DO CALL :Print_and_set myJava "%%A"
FOR /F "TOKENS=2 DELIMS==" %%A IN ('WMIC OS GET CSNAME /format:list^|FIND "="') DO CALL :Print_and_set myCS "%%A"
ECHO.
SET my

GOTO :EOF

:Print_and_set
ECHO %1 is %2
SET %1=%2

(for some strange reason - at least on my machine - there is a display glitch and the "m" in my%%A for the description is omitted, so I used the CALL)

jaclaz 
 

  • Author

i got what i wanted in just one line

it gives me the computer name and java ver

wmic /output:c:\report.csv product where "name like 'java%'" get description /format:csv

Yes :), but you create a (temporary) file that - before or later - you will need to parse in order to use the information in it.

The output of that on my machine:
 

Quote


Node,Description
CINQUE,Java(TM) 6 Update 24
CINQUE,Java 8 Update 66
CINQUE,Java Auto Updater

jaclaz
 

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.