How do I determine if a computer is running XP Ser

2019-02-23 02:06发布

问题:

Using either the registry or the file system. The reason for the restriction is that I am doing this as an MSI conditional statement.

Cheers!

回答1:

under registry key

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion

look for key pair:

CurrentVersion = Microsoft Windows NT 5.1.2600 Service Pack 3



回答2:

You should find enough information to determine the OS service pack (in the worst case you can always use the build string) in the following registry key:


HKLM\Software\Microsoft\Windows NT\CurrentVersion


回答3:

If you're using an MSI, you should be able to use the VersionNT and ServicePackLevel properties right in the conditional statement.

eg. The following code checks for Windows XP sp3 or greater:

VersionNT=501 And ServicePackLevel>2

You can also check the WindowsBuild property if you also need the build number.



回答4:

The VerifyVersionInfo function should allow you to check the version of Windows being run meets your application's requirements, without the pitfalls that can occur with checking for an exact version with GetVersionEx (such as breaking on major version changes - your application will most likely run on Vista, and Windows 7, and future versions not yet developed).



回答5:

"Run" (Windows key + r or start/run) msinfo32 or sysdm.cpl