How to parse WMIC printer list full

Ty Flo picture Ty Flo · Jun 20, 2018 · Viewed 8.2k times · Source

When I use the following command, it outputs a text file with a computer's printer information: wmic printer list full >> c:\computer_printers.txt

However, the list is very long, and I only want to see the fields for DriverName, Name, and Portname in the output. Is there a way to modify the command I am using to get this result?

I researched the adverbs associated with the verb List, but the way I am interpreting the document here (https://msdn.microsoft.com/en-us/library/aa394531(v=vs.85).aspx), it does not seem like what I am trying to do is possible. Is there anyone with more experience with WMIC that can confirm this?

Answer

DavidPostill picture DavidPostill · Jul 2, 2018

I only want to see the fields for DriverName, Name, and Portname in the output

Use the following command:

wmic printer get DriverName, Name, Portname >> c:\computer_printers.txt

Example output:

> type c:\computer_printers.txt
DriverName                       Name                             PortName
Microsoft XPS Document Writer    Microsoft XPS Document Writer    XPSPort:
Microsoft Shared Fax Driver      Fax                              SHRFAX:
EPSON Stylus Photo RX560 Series  EPSON Stylus Photo RX560 Series  USB001
CutePDF Writer                   CutePDF Writer                   CPW2:

Further Reading