简体   繁体   English

如何确定可移动驱动器上安装的Windows版本

[英]How do I determine the Windows version installed on a removable drive

I am unable to find out how to determine the version of Windows installed on a removable/slave drive. 我无法确定如何确定可移动/从属驱动器上安装的Windows版本。 In my search I discovered the DriveInfo class, which has some neat stuff, but doesn't show me if the drive has XP, or Vista or higher (I need to know this since they have different directory structures and I want to automate the process of backing up their data). 在我的搜索中,我发现了DriveInfo类,它具有一些简洁的内容,但是没有显示驱动器是否具有XP或Vista或更高版本(我需要知道这一点,因为它们具有不同的目录结构,并且我想使该过程自动化备份他们的数据)。

Will I have to access the drive's registry somehow? 我是否必须以某种方式访问​​驱动器的注册表? I want to avoid that if possible because it's complicated, and at the end of the day I just want to do something like (crappy psuedocode): 我想尽可能避免这种情况,因为它很复杂,并且最终,我只想做类似(糟糕的psuedocode)的操作:

if drive.has(XP) then 如果drive.has(XP)然后

else 其他

end if 万一

Any help would be greatly appreciated. 任何帮助将不胜感激。 Thank you. 谢谢。

From Is there a way to find out my Windows 7-version without booting? 有没有一种方法可以找出我的Windows 7版本而不进行引导? , not a programmer's way but a power user's . ,而不是程序员的方式,而是高级用户的方式

Go to

C:\\Windows\\System32 C:\\ Windows \\ System32下

read the "license.rtf" file 读取“ license.rtf”文件

Since you have access to all the files on the removable disk...right? 由于您可以访问可移动磁盘上的所有文件...对吗? now it is about using VB.NET to parse the RTF file. 现在它是关于使用VB.NET解析RTF文件。

An alternative way to determine the operating system version is documented on the MSDN page "Getting the System Version" : 确定操作系统版本的另一种方法记录在MSDN页面“获取系统版本”中

To obtain the full version number for the operating system, call the GetFileVersionInfo function on one of the system DLLs, such as Kernel32.dll, then call VerQueryValue to obtain the \\StringFileInfo\\\\ProductVersion subblock of the file version information. 若要获取操作系统的完整版本号,请在系统DLL之一(例如Kernel32.dll)上调用GetFileVersionInfo函数,然后调用VerQueryValue以获取文件版本信息的\\ StringFileInfo \\\\ ProductVersion子块。

Luckily, that will work for offline instances just as well as for the running instance. 幸运的是,这将适用于脱机实例以及正在运行的实例。 The only real complication is if you need to cope with the possibility that the system folder has been given a non-standard name. 唯一真正的麻烦是,如果您需要应对系统文件夹被赋予非标准名称的可能性。

You could do this using regedit. 您可以使用regedit进行此操作。

Import the software hive from the registry of the drive in question using regedit. 使用regedit从相关驱动器的注册表中导入软件配置单元。 It's located in %SYSTEMROOT%\\system32\\config. 它位于%SYSTEMROOT%\\ system32 \\ config中。 It doesn't matter where you import it to (let's suppose HKEY_LOCAL_MACHINE) or the name you pick. 将其导入到哪里(假设为HKEY_LOCAL_MACHINE)或选择的名称都没有关系。 Regedit is normally in C:\\Windows. Regedit通常在C:\\ Windows中。 It can be launched from the command prompt if necessary. 如有必要,可以从命令提示符启动它。

Then check the version in the key (HKEY_LOCAL_MACHINE//Microsoft/Windows NT/CurrentVersion) under the hive you imported. 然后,在导入的配置单元下的键(HKEY_LOCAL_MACHINE // Microsoft / Windows NT / CurrentVersion)中检查版本。

More here: https://blog.skullsecurity.org/2010/find-the-windows-version-offline 此处更多内容: https//blog.skullsecurity.org/2010/find-the-windows-version-offline

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM