Monday, January 03, 2011

Command Line: Display File Attribute with WMIC

If you do any command line scripting occasionally you need to get some extended file attributes, such as version information from an .EXE file. The WMIC command line utility allows you to extract this information and whole lot more.  Over the next few weeks I hope to highlight some of it's power.

I have included some examples of how to use this command below.

Displays All Attributes of the NOTEPAD.EXE
(This command generates a space delimited table of values)
wmic datafile where name='c:\\windows\\system32\\notepad.exe'
- OR -
wmic datafile where name='c:\\windows\\system32\\notepad.exe' > output.txt

Displays Select Attributes of the NOTEPAD.EXE (e.g.: Version Info) 
wmic datafile where name='c:\\windows\\system32\\notepad.exe' get version 

Displays the help information
wmic datafile get /?

No comments: