开发者

product version number

开发者 https://www.devze.com 2023-01-21 09:31 出处:网络
I want to retrive the product version number of an exe. If possible I need some thing which can work from the command line.

I want to retrive the product version number of an exe. If possible I need some thing which can work from the command line.

开发者_高级运维

Also is there an utility for unix as well? I need this on both mac and pc.

Thanks in advance.

Gaur


System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

or

using System.Diagnostics;
...

public void GetFileVersion()
{
// Get the file version for the notepad.
FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(@"C:\A.exe");

// Print the file name and version number.
String text = "File: " + myFileVersionInfo.FileDescription + '\n' +
"Version number: " + myFileVersionInfo.FileVersion;
Console.WriteLine(text);
}

or via reading the PE header of the EXE is probably the best bet:

http://msdn.microsoft.com/en-us/library/ms809762

0

精彩评论

暂无评论...
验证码 换一张
取 消