有没有一种方法,以确定在命令行中的.NET Framework版本?命令行、版本、方法、NET

2023-09-02 01:46:03 作者:メ唯丶蝴蝶☆美゜

要解决的安装,有时我只是想快速的答案是安装什么版本的.NET。

有没有一种方法,以确定不是看目录的.NET Framework版本标准的Windows系统上,其他的?

注意:这不是一个开发机器,刚出来的开箱即用的窗口

下面的作品,但我正在寻找一个更简单的方法。

目录%WINDIR% Microsoft.Net 框架 V *

 目录的C: WINDOWS  Microsoft.Net 框架

2009年7月13日下午7时20分< D​​IR> V1.0.3705
2009年7月13日下午7时20分< D​​IR> V1.1.4322
2010年1月20日下午1时16< D​​IR> V2.0.50727
2009年7月13日下午9时37< D​​IR> V3.0
2010年1月20日下午1时02分 - 其中,DIR> V3.5
2010年2月10日上午3时20< D​​IR> v4.0.21006
 
获取所有进程占用资源的信息

更新:没有一个解决方案,但另一个很酷的目录格式的房源

目录%WINDIR% Microsoft.Net 框架 V * / O:-N / B

  v4.0.21006
V3.5
V3.0
V2.0.50727
V1.1.4322
V1.0.3705
 

解决方案

根据您的更新,表示这是通过它走非高科技精明的最终用户,我建议去斯科特Hanselman的网站的 http://www.smallestdotnet.com (使用Internet Explorer),它使用用户代理字符串来告诉你哪些.NET框架你有并为您提供建议起床到最新版本以最有效的方式。

旧答案 使用PowerShell你可以这样做(尽管PowerShell中的presence已经意味着至少.NET 2.0)

  GET-ChildItem$($ ENV:WINDIR) Microsoft.Net 框架-i mscorlib.dll中-r |
    的foreach对象{$ _。VersionInfo.ProductVersion}
 

我不知道,如果有一个可比较的方式来获得在普通的旧硬皮cmd.exe的版本信息。

To troubleshoot an installation, sometimes I just want a quick answer to what version of .NET is installed.

Is there a way to determine the .NET Framework version on a standard Windows system, other than looking at the directories?

NOTE: This is not for a development machine, just out-of-the-box windows

The following works, but I'm looking for a simpler way.

dir %WINDIR%Microsoft.NetFrameworkv*

Directory of C:WindowsMicrosoft.NetFramework

07/13/2009  07:20 PM    <DIR>          v1.0.3705
07/13/2009  07:20 PM    <DIR>          v1.1.4322
01/20/2010  01:16 PM    <DIR>          v2.0.50727
07/13/2009  09:37 PM    <DIR>          v3.0
01/20/2010  01:02 PM    <DIR>          v3.5
02/10/2010  03:20 AM    <DIR>          v4.0.21006

UPDATE: Not a solution, but another cool directory formatted listing

dir %WINDIR%Microsoft.NetFrameworkv* /O:-N /B

v4.0.21006
v3.5
v3.0
v2.0.50727
v1.1.4322
v1.0.3705

解决方案

Based on your update which indicates this is for walking a non-tech savvy end user through it, I suggest going to Scott Hanselman's site http://www.smallestdotnet.com (use Internet Explorer) which uses the user agent string to tell you which .NET Framework you've got and gives you recommendations for getting up to the latest version in the most efficient manner.

Old Answer With PowerShell you could do this (although the presence of PowerShell already implies at least .NET 2.0)

Get-ChildItem "$($Env:WinDir)Microsoft.NetFramework" -i mscorlib.dll -r |
    ForEach-Object { $_.VersionInfo.ProductVersion }

I don't know if there's a comparable way to get the version information in plain old crusty cmd.exe.