开发者

Getting Manufacturer and Modal # from XP Home with Java or the Command Line

开发者 https://www.devze.com 2023-04-09 11:35 出处:网络
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 wer开发者_StackOverflow社区e very helpful, but Windows XP Home Pre

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 wer开发者_StackOverflow社区e 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.


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.)


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号