|
感觉不应该是按系统真实版本才正确吗,用户应该不管explorer.exe的版本吧。
楼主是不知道怎么从注册表获取系统版本号吗?我写了一个从指定盘符注册表文件获取系统版本信息的脚本,支持在线和离线系统,你看下对你有没用。
使用方法,代码复制到记事本,保存为ANSI格式。
调用:获取版本.bat C:
传参盘符,会在脚本当前目录生成版本信息文件
- @echo off
- if /i "%UserName%" == "SYSTEM" (Goto GotAdmin) else (reg query "HKLM\SYSTEM\ControlSet001\Control\MiniNT" 1>nul 2>nul&&Goto GotAdmin)
- :BatchGotAdmin
- Set _Args=%*
- if `%1` neq `` Set "_Args=%_Args:"=""%"
- if exist %WinDir%\System32\fltMC.exe fltMC 1>nul 2>nul||mshta VBScript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c """"%~f0"" %_Args%""",,"runas",1)(Window.Close) 2>nul&&Exit /b
- :GotAdmin
- Pushd "%CD%"&cd /d "%~dp0"
- Setlocal EnableDelayedExpansion
- if `%1` neq `` Set "Input=%~1"&Goto Start
- Set n=0&for %%i in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist "%%i:\Windows\System32\Config\SOFTWARE" if exist "%%i:\Windows\System32\Config\SYSTEM" Set /a n+=1&Set dsk!n!=%%i
- if !n! == 1 (Set Input=!dsk1!&Goto Start) else Exit /b
- :Start
- Set Input=%Input:~0,1%
- cd.>"%~dp0[%Input%盘]系统信息.txt"&&Set PCInfo="%~dp0[%Input%盘]系统信息.txt"||Set PCInfo="%TEMP%\[%Input%盘]系统信息.txt"
- if /i "%Input%:" neq "%SystemDrive%" (
- for %%a in (SOFTWARE SYSTEM) do if not exist "%Input%:\Windows\System32\Config\%%a" (echo 找不到注册表文件!!&echo "%Input%:\Windows\System32\Config\%%a")>%PCInfo%&Exit /b
- reg load HKLM\PC_SOF %Input%:\Windows\System32\Config\SOFTWARE 1>nul 2>nul
- reg load HKLM\PC_SYS %Input%:\Windows\System32\Config\SYSTEM 1>nul 2>nul
- Call :GetInfo PC_SOF PC_SYS
- reg unload HKLM\PC_SOF 1>nul 2>nul
- reg unload HKLM\PC_SYS 1>nul 2>nul
- ) else Call :GetInfo SOFTWARE SYSTEM
- Endlocal
- Exit /b
- :GetInfo
- for /f "tokens=1,2*" %%a in ('reg query "HKLM\%2\select" 2^>nul') do if /i "%%a" == "Default" Set /a x=%%~c
- Set "Env=ControlSet00%x%\Control\Session Manager\Environment"
- Set "Cuv=Microsoft\Windows NT\CurrentVersion"
- for /f "tokens=1,2*" %%a in ('reg query "HKLM\%2\%Env%" 2^>nul') do if /i "%%a" == "PROCESSOR_ARCHITECTURE" Set bit=%%~c
- for /f "tokens=1,2*" %%a in ('reg query "HKLM\%1\%Cuv%" 2^>nul') do (
- if /i "%%a" == "SystemRoot" Set SR=%%c
- if /i "%%a" == "ProductName" Set PN=%%c
- if /i "%%a" == "DisplayVersion" Set DV=%%c
- if /i "%%a" == "CurrentVersion" Set CV=%%c
- if /i "%%a" == "CurrentMajorVersionNumber" Set /a CN0+=%%c
- if /i "%%a" == "CurrentMinorVersionNumber" Set /a CN1+=%%c&Set CN1=.!CN1!
- if /i "%%a" == "CurrentBuildNumber" Set CBN=.%%c
- if /i "%%a" == "UBR" Set /a UBR+=%%c&Set UBR=.!UBR!
- )
- if defined CN0 if defined CN1 Set CV=%CN0%%CN1%
- if defined CBN if %CBN:~1% geq 22000 if defined PN Set PN=%PN: 10 = 11 %
- :: 输出格式
- >%PCInfo% echo [%SR%] %PN% 版本 %DV%^(%CV%%CBN%%UBR%^) x%bit:~-2%
- Goto :eof
复制代码
|
|