Reputation:
I already tried several examples found on web about how list some info of a product using wmic
but until now withou sucess.
My last attempt that can be see below was based on code of this answer, but comes a error saying:
No Instance(s) Available
@echo off
for /f "skip=1 delims==" %%a in (
'wmic product where "Name like 'Java'" get name /format:table'
) do (
for /f "tokens=* delims=" %%# in ("%%a") do set PROD=%%a
)
echo %PROD%
pause
There is solution to this?
Upvotes: 0
Views: 749
Reputation: 30143
You need to use some wildcard(s) with like
WQL operator to determine whether or not a given character string matches a specified pattern, e.g. as follows:
@ECHO OFF
SETLOCAL EnableExtensions EnableDelayedExpansion
for /f "usebackq skip=1 delims==" %%a in (
`wmic product where "Name like 'Java%%'" get name /format:table`
) do (
for /f "tokens=* delims=" %%# in ("%%a") do (
set "PROD=%%~#"
echo !PROD!
)
)
echo PROD (final value)=%PROD%
Sample output:
Java 8 Update 151
Java 8 Update 151 (64-bit)
Java Auto Updater
PROD (final value)=Java Auto Updater
Upvotes: 1