从非特权用户命令行查找Windows版本 [英] Find out windows version from non-privileged user command line

查看:100
本文介绍了从非特权用户命令行查找Windows版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一种方法来找出我使用简单的命令行工具(没有powershell)运行的Windows版本。我需要它从一个非特权的用户工作,我需要能够解析出Windows XP,Vista,服务器2008和7之间的区别。我目前使用:
wmic os get Caption 但是当用户没有运行wmic的权限时失败。

I need a way to find out what version of windows I'm running in using simple command line tools (no powershell). I need it to work from a non-privileged user, and I need to be able to parse out the difference between Windows XP, Vista, server 2008, and 7. I'm currently using: wmic os get Caption but that fails when the user doesn't have permissions to run wmic.

更新:
为了澄清,我需要这个命令不打破不同的服务包级别,这可能会排除解析特定的版本号。此外,如果您查看此列表的Windows版本,您会看到在Windows 7和服务器2008 r2上报告的数字是相同的。

Update: To clarify, I need this command to not break with different service pack levels, etc. which probably rules out parsing a specific version number. Also if you look at this list of windows versions, you'll see that the numbers reported on Windows 7 and server 2008 r2 are the same.

推荐答案

通过解析输出:

reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v "ProductName"

这篇关于从非特权用户命令行查找Windows版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆