[英]How to determine Windows version from a batch script for an inactive drive?
How can one get the version of Windows from the shell (command prompt) via a batch script for a drive that does not contain the active OS?如何通过不包含活动操作系统的驱动器的批处理脚本从 shell(命令提示符)获取 Windows 的版本? I was hoping for some file that I could test, but it turns out things are a little more vague than I'd hoped.
我希望有一些我可以测试的文件,但事实证明事情比我希望的要模糊一些。 This should be able to determine the version of Windows for all NT releases from 2000 to 8.1.
这应该能够确定从 2000 到 8.1 的所有 NT 版本的 Windows 版本。
you can load the windows registry from the "inactive OS' Drive" and read the version from it: 你可以从“非活动的OS'驱动器”加载Windows注册表并从中读取它的版本:
this is not tested, but it's something like this: 这没有经过测试,但它是这样的:
set SYSTEM_DRIVE=D:
reg load "HKU\ttt" "%SYSTEM_DRIVE%\Windows\System32\config\SOFTWARE"
reg query "HKU\ttt\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName
reg unload "HKU\ttt"
我认为一个相当强大的方法是查看标准操作系统文件的文件版本元数据,例如%SystemRoot%\\ system32 \\ winver.exe。
I did the following (from command prompt): 'findstr /i "filever.sion" kernel32.dll > ver' The dots are required because the metadata is unicode, and findstr will thus ignore the zeros that are between the letters (dot being a wildcard for "any single character").我执行了以下操作(在命令提示符下): 'findstr /i "filever.sion" kernel32.dll > ver' 点是必需的,因为元数据是 unicode,因此 findstr 将忽略字母之间的零(点被“任何单个字符”的通配符)。 (see: findstr /?).
(参见:findstr /?)。 The snippet can be examined in notepad or, on some systems that still support "EDIT", "EDIT /70 VER".
可以在记事本或某些仍支持“EDIT”、“EDIT /70 VER”的系统上检查该片段。 The output is still unicode, but it can be "prettied up" using programming (f/e vbscript).
output 仍然是 unicode,但可以使用编程 (f/e vbscript) 对其进行“美化”。 the raw material can be examined "as is": F ile V e r sion 6. 1. 7 6 0 1. 1 9 1 3 5 ( win 7 sp 1 _ gd r. 1 6 0 1 2 1 - 1 7 1 8 ) 2. Googling windows versions yielded: me=4.9, 2000=5.0, xp=5.1, vista=6.0, 7=6.1, 8=6.2, 8.1=6.3, 10=10.0, (then a bunch more while microsoft put out fires, then 11=21H2. (7601 is the "build" number") Above taken from: https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
可以“按原样”检查原材料:文件 V e r sion 6. 1. 7 6 0 1. 1 9 1 3 5 ( win 7 sp 1 _ gd r. 1 6 0 1 2 1 - 1 7 1 8 ) 2. 谷歌搜索 windows 版本:me=4.9, 2000=5.0, xp=5.1, vista=6.0, 7=6.1, 8=6.2, 8.1=6.3, 10=10.0, (然后微软推出了更多触发,然后 11=21H2。(7601 是“内部版本”编号)以上摘自: https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.