How can I use a delimiter in wmic output, separating columns?

Posted by Abhishek Simon on Stack Overflow See other posts from Stack Overflow or by Abhishek Simon
Published on 2012-08-30T07:14:42Z Indexed on 2012/08/30 9:38 UTC
Read the original article Hit count: 592

Filed under:
|
|
|
|

I want to fetch Windows Hotfix listing with some format, whose output can be separated with some delimiter. so far I found a wmic command which gives me a desired output but the problem is the \s delimiter is not going to work here. Is there a way I can place some , or anyother character, which I can later use in java program to get individual columns?

Command

wmic qfe get caption,csname,description,hotfixid,installedby,installedon

Output

Caption                                        CSName    Description      HotFixID   InstalledBy          InstalledOn
http://go.microsoft.com/fwlink/?LinkId=161784  Abhishek  Update           KB971033   NT AUTHORITY\SYSTEM  3/15/2012
http://support.microsoft.com/?kbid=2032276     Abhishek  Security Update  KB2032276  NT AUTHORITY\SYSTEM  3/15/2012
..
.

Update

I am trying

for /f "tokens=1,2,3,4,5,6,7,8,9,10,11" %g in ('wmic qfe get caption,csname,description,fixcomments,hotfixid,installdate,installedby,installedon,name,servicepackineffect,status') do @echo %g,%h,%i,%j,%k,%l,%m,%n,%o,%p

but it gives me invalid GET Expression

C:\Users\Abhishek\Desktop>for /f "tokens=1,2,3,4,5,6,7,8,9,10,11" %g in ('wmic qfe get caption,csname,description,fixcomments,hotfixid,installdate,installedby,installedon,name,servicepackineffect,status') do @echo %g,%h,%i,%j,%k,%l,%m,%n,%o,%p
Invalid GET Expression.

What is the problem here? This might solve the problem for me .

More Update

I even tried the below command but this too does not solve space problem

Command

for /f "tokens=1,2,3,4,5,6,7,8,9,10,11" %g in ('wmic qfe list') do @echo %g,%h,%i,%j,%k,%l,%m,%n,%o,%p

Output

Caption,CSName,Description,FixComments,HotFixID,InstallDate,InstalledBy,InstalledOn,Name,ServicePackInEffect
http://go.microsoft.com/fwlink/?LinkId=161784,Abhishek,Update,KB971033,NT,AUTHOR,,Y\SYSTEM,3/15/2012,
http://support.microsoft.com/?kbid=2281679,Abhishek,Security,Update,KB2281679,NT,AUTHORITY\SYSTEM,3/15/2012,
http://support.microsoft.com/?kbid=2284742,Abhishek,Update,KB2284742,NT,AUTHORIT,,SYSTEM,3/15/2012,
http://support.microsoft.com/?kbid=2286198,Abhishek,Security,Update,KB2286198,NT,AUTHORITY\SYSTEM,3/15/2012,

© Stack Overflow or respective owner

Related posts about java

Related posts about Windows