有没有办法从命令行确定.NET Framework版本? [英] Is there a way to determine the .NET Framework version from the command line?
问题描述
要解决安装问题,有时我只想快速回答安装的是什么版本的.NET。
To troubleshoot an installation, sometimes I just want a quick answer to what version of .NET is installed.
有没有办法确定.NET Framework版本在标准的Windows系统上,除了查看目录之外?
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.Net\Framework\v *
Directory of C:\Windows\Microsoft.Net\Framework
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:不是解决方案,而是另一个很酷的目录格式化列表
UPDATE: Not a solution, but another cool directory formatted listing
dir%WINDIR%\Microsoft.Net\Framework\v * / O:-N / B
v4.0.21006
v3.5
v3.0
v2.0.50727
v1.1.4322
v1.0.3705
推荐答案
根据您的更新一个非技术精明的最终用户,通过它,我建议去Scott Hanselman的网站 http://www.smallestdotnet.com < a>(使用Internet Explorer),它使用用户代理字符串告诉您您拥有的.NET Framework,并提供了以最有效的方式获取最新版本的建议。
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.
旧答案
使用PowerShell,您可以这样做(虽然PowerShell的存在至少意味着.NET 2.0)
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.Net\Framework" -i mscorlib.dll -r |
ForEach-Object { $_.VersionInfo.ProductVersion }
有一个类似的方法来获取版本信息在普通的旧crusty cmd.exe。
I don't know if there's a comparable way to get the version information in plain old crusty cmd.exe.
这篇关于有没有办法从命令行确定.NET Framework版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!