Topic
  • No replies
thalapathi
thalapathi
129 Posts

Pinned topic Parsing command output inside for loop in WIndows Batch

‏2013-01-22T22:17:04Z |
Hi All,

I am trying to get the installed product list using the for loop in Batch file. Based on the product name, I have to do certain check!

I am not familiar with Batch script. Please help me if anyone got any idea on the below for loop to assign the output to a variable. (Note: wmic is the built-in windows utility)

Code:

@echo off
set RATIONAL_PRODUCT=0
for /F %%A in ('wmic product where "Name like '%%Rational%%'" get Name,Version') do (
set RATIONAL_PRODUCT= %%A
)

Thanks in advance.

Cheers,
Jose