开发者

product version number

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜