powershellcmdfile-properties

Fetch 'Copyright' info field for an exe using commandline in Windows Server 2016


I am interested in getting the 'Copyright' information field using the cmd or PowerShell. Manually, it can be accessed by

RighClick the executable -> Properties -> Details -> Copyright

I am aware of the wmic datafile command,

wmic datafile where Name="C:\Windows\System32\cmd.exe" get Manufacturer,Name,Version

but it does not give most of the detailed information from the Details tab in the file properties.

How do I get this info using cmd or PowerShell? I believe Python should be able to solve it easily, but sometimes it is not an option to install python on production server.


Solution

  • Powershell actually gives you a plethora of information in the VersionInfo property.

    (Get-Item "C:\Windows\System32\cmd.exe").VersionInfo.LegalCopyright
    

    Here is a technet article with more information if you need it.
    https://blogs.technet.microsoft.com/askpfeplat/2014/12/07/how-to-correctly-check-file-versions-with-powershell/