I'm trying to get the output of the WMIC command to assign variables to each line.
I'm trying to get the out put to look like this:
1 first program installed
2 second program installed
3 third program installed
4 fourth program installed
5 ...etc
@Echo off
wmic /output:file.txt product get name /format:csv
rem wmic product get name
@Echo Off
SetLocal EnableDelayedExpansion
Set n=
Set _InputFile=c:\users\jorge\desktop\file.txt
For /F "tokens=*" %%I IN (%_InputFile%) DO (
Set /a n+=1
Set _var!n!=%%I
)
:: This line will display the variables just assigned
:: For testing only, delete when not needed
Set _
EndLocal
pause