使用 Java 或命令行从 XP Home 获取制造商和模态编号

发布于 2024-12-07 08:44:32 字数 253 浏览 0 评论 0原文

如何获取 XP Home 计算机的制造商和型号?三个月前我在此处提出了类似的问题。答案非常有帮助,但 Windows XP Home Premium Edition 没有 wmicsysteminfo。我查看了几台机器的注册表,没有发现任何一致的模式。

你有什么想法吗?我想坚持使用 Java 和命令行。

How can I get the Manufacturer and the Modal Number of an XP Home computer? I asked a similar question 3 months ago here. The answers were very helpful, but Windows XP Home Premium Edition does not have wmic or systeminfo. I looked in the registry on a few machines and did not find any consistent patterns.

Do you have any ideas? I'd like to stick with Java and the Command Line.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情归归情 2024-12-14 08:44:32

REG QUERY HKLM\HARDWARE\DESCRIPTION\System\BIOS -v SomeValueName 为您提供一些有关系统的信息,具体取决于您使用的 SomeValueName

SystemProductName 返回我的笔记本电脑的型号。 BaseBoardProduct 具有相同的值,但在某些机器上两者完全有可能不同。其中之一应该会给你一个型号。

SystemManufacturerBaseBoardManufacturer 包含我的笔记本电脑制造商的名称。同样,两者可能有所不同。

您可以通过查询 HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation 来获取信息,即“型号”和“制造商”值。但这看起来像是在 OEM 安装期间存储的信息(例如当您使用戴尔的安装光盘在计算机上重新安装 Windows 时),并且在自制系统上可能不存在(或可能无用)。

请注意,REG QUERY 返回的内容采用您可能需要解析的特定格式。它并不复杂,但是 REG QUERY /? 似乎没有提到摆脱标头和 REG_SZ 等返回的方法。

(另请注意:这对您来说可能是显而易见的......但是当您使用 Runtime.exec 执行程序来查询 Windows 注册表时,您就将自己与 Windows 联系在一起了。)

REG QUERY HKLM\HARDWARE\DESCRIPTION\System\BIOS -v SomeValueName gives you some info about the system, depending on what you use for SomeValueName.

SystemProductName returns the model of my laptop. BaseBoardProduct has the same value, but it's entirely possible that the two will differ on some machines. One of those should give you a model number.

SystemManufacturer and BaseBoardManufacturer have the name of my laptop's manufacturer. Again, the two might differ.

You might be able to get the info by querying HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation, namely the "Model" and "Manufacturer" values. But that looks like info that'd be stored during an OEM install (like when you use Dell's install disc to reinstall Windows on your machine), and may not be present (or may be useless) on home-built systems.

Note, the stuff returned by REG QUERY is in a particular format that you may need to parse. It's not complex, but REG QUERY /? doesn't seem to mention a way to get rid of the headers and the REG_SZ and such that get returned.

(Also note: This is probably obvious to you...but the instant you use Runtime.exec to execute programs to query the Windows registry, you tie yourself to Windows.)

无所谓啦 2024-12-14 08:44:32

使用 Runtime.getRuntime().exec() 执行适当的 Windows 命令来检查注册表、捕获输出并解析它以获取所需的信息。

Use Runtime.getRuntime().exec() to execute the appropraite windows command that inspects the registry, capture the output and parse it for the information you need.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文