简体   繁体   English

如何从非活动驱动器的批处理脚本中确定 Windows 版本?

[英]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.

相关问题 Windows 10:如何确定是否正在从网络映射的驱动器运行批处理文件 - Windows 10: How can I determine whether a batch file is being run from network mapped drive 快速命令或批处理脚本确定 Windows 和 Office 版本 - quick command or batch script to determine Windows and Office version 如何使用批处理脚本将文件从一台Windows计算机复制到特定驱动器中的另一台Windows计算机? - How to copy the file from one windows machine to another windows machine in a particular drive using batch script? 如何确定可移动驱动器上安装的Windows版本 - How do I determine the Windows version installed on a removable drive 用于选择驱动器依赖于标签的 Windows 批处理脚本 - Windows batch script for selecting drive depent on label Windows 批处理脚本获取当前驱动器名称 - Windows Batch Script Get Current Drive name 在 Windows 批处理脚本中确定动态文件名? - Determine dynamic file name in Windows batch script? 如何使用批处理文件将文件从USB驱动器复制到Windows 10中的C驱动器? - How to copy a file from a USB drive to C drive in Windows 10 using a batch file? 如何在Windows自动启动中确定当前驱动器号? - How to determine the current drive letter in autostart in Windows? 如何使用批处理来确定计算机正在运行的 Windows 版本? - How can I use batch to determine what version of windows a computer is runing?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM