How to get .exe file version number from file path

前端 未结 7 1944
猫巷女王i
猫巷女王i 2020-12-08 06:16

I am using .Net 3.5/4.0 with code in C#.

I am trying to get a version number of an exe file on my C: drive.

For example path is: c:\\Program\\demo.exe. If t

7条回答
  •  情书的邮戳
    2020-12-08 06:38

    I'm not sure if this is what you are looking for, but:

    http://www.daniweb.com/software-development/csharp/threads/276174/c-code-to-get-dll-version

    It says,

    // Get the file version info for the notepad.
    FileVersionInfo myFileVersionInfo =  FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\\notepad.exe");
    
    // Print the file name and version number.
    Console.WriteLine("File: " + myFileVersionInfo.FileDescription + '\n' + "Version number: " + myFileVersionInfo.FileVersion);
    

提交回复
热议问题