- Understanding wmic
- Configuring the Firewall to Allow wmic
- Running wmic
- Modifying the Format with the /format Switch
- Retrieving Help from wmic
- Understanding Aliases
- Using Verbs
Modifying the Format with the /format Switch
The /format switch has a few more options that you might find useful. It can be very useful when you combine it with the /output switch to send the data to a file in a specific format.
Format Switch |
Description |
table /format:table C:\>wmic computersystem list full / format:table |
Formats the output as a table with headers. |
list /format:list C:\>wmic computersystem list full / format:list |
Formats the output as a list of each property followed by the value. |
csv /format:csv C:\>wmic computersystem list full / format:csv C:\>wmic /output:c:\data\test.csv computersystem list full /format:csv |
Formats the output as comma-separated values. The header is displayed first separated by commas. The data is then displayed separated by commas. CSV files are easily read in Microsoft Excel, so it's common to use the output switch to send this data to a file. |
xml /format:xml C:\>wmic computersystem list full / format:xml C:\>wmic /output:c:\data\test.xml computersystem list full /format:xml |
Formats the output in Extensible Markup Language (XML) format. If you enter the path to the XML file (such as C:\data\test.xml), the file opens in your web browser. |
hform C:\>wmic computersystem list full / format:hform C:\>wmic /output:c:\data\test.html computersystem list full /format:hform |
Formats the output as an HTML document. This is useful to display all the properties of an object on a separate row. If you enter the path to the HTML file (such as C:\data\test.html), the file opens in your web browser. Figure 16-2 shows the output of this command. |
htable C:\>wmic computersystem list brief /format:htable C:\>wmic /output:c:\data\test3.html useraccount list brief /format:htable |
Formats the output as an HTML document. In the table format, each object is a single row. Figure 16-3 shows the output of this command. |
Figure 16-2 Viewing the Output of wmic in Internet Explorer in hform Format
Figure 16-3 Viewing the Output of wmic in Internet Explorer in htable Format