C#获取应用程序的版本。 [英] C# Get the Versions of applications.
问题描述
我是新手,需要C#的帮助。
如何获得应用程序版本。
我有桌面应用程序 和我 创建标签。
现在我希望我的标签能在计算机上显示当前版本的程序。
让我们说:
Skype: - 版本 -
Notepad ++: - 版本
Chrome:   -version
如果我可以告诉C:\Program Files \Notepad ++ \\\
otepad ++。exe并得到我的版本..
Hi, i'm new in this and need help on C#.
How can i get the Versions of applications.
I have desktop app and i create label.
Now i want that my label will show current versions of programs on computer.
lets say :
Skype: - version -
Notepad++ : - version
Chrome : -version
If i can just tell C:\Program Files\Notepad++\notepad++.exe and get me version of this..
i认为 类似于
i think something like
var versionskype =(路径 用于 程序和获取版本)
var versionskype = (path for program and get version)
var versionnote =(路径 用于 程序和获取版本)
var versionnote = (path for program and get version)
var chrome =(路径 用于 程序和获取版本)
var chrome = (path for program and get version)
推荐答案
你好,
在Win7上VS2012中的C#Console项目示例中使用记事本;
Using Notepad in my example of C# Console project in VS2012 on Win7;
代码
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
namespace FileVer
{
class Program
{
static void Main( string[] args )
{
string src = @"C:\Windows\system32\notepad.exe";
Console.WriteLine( System.Diagnostics.FileVersionInfo.GetVersionInfo( src ).ToString() );
}
}
}
MSDN Class Link
MSDN Class Link
https://msdn.microsoft.com/en-us/library/system.diagnostics.fileversioninfo(v = vs.110).aspx
https://msdn.microsoft.com/en-us/library/system.diagnostics.fileversioninfo(v=vs.110).aspx
希望这有助于:)
Hope this helps :)
这篇关于C#获取应用程序的版本。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!