|  | 
| 根据已知问题进行了修改
 复制代码[url=home.php?mod=space&uid=336905]@echo[/url] off
cd /d "%~dp0"
title 检测当前系统版本
color f0
(cacls "%SystemDrive%\System Volume Information" >nul 2>&1) || (
    start "" mshta vbscript:CreateObject^("Shell.Application"^).ShellExecute^("%~snx0"," %*","","runas",1^)^(window.close^)
    exit /b
)
:: 获取系统版本信息
for /f "tokens=2* skip=2" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ProductName"') do set SystemVersion=%%b
for /f "tokens=2* skip=2" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "CurrentBuild"') do set BuildVersion=%%b
:: 输出调试信息
echo 检测到的系统版本: %SystemVersion%
echo 检测到的内部版本号: %BuildVersion%
:: 检查系统版本,确保精确匹配
if /i "%SystemVersion%"=="Windows XP" goto WinXP
if /i "%SystemVersion%"=="Windows 7" goto Win7
if /i "%SystemVersion%"=="Windows 8" goto Win8
if /i "%SystemVersion%"=="Windows 10 Pro" (
    if %BuildVersion% GEQ 22000 goto Win11
    goto Win10
)
:: 未检测到已知版本时的处理
echo 无法检测到已知的 Windows 版本。
goto End
:WinXP
echo.
echo 当前系统为 Windows XP
goto End
:Win7
echo.
echo 当前系统为 Windows 7
goto End
:Win8
echo.
echo 当前系统为 Windows 8
goto End
:Win10
echo.
echo 当前系统为 Windows 10
goto End
:Win11
echo.
echo 当前系统为 Windows 11
goto End
:End
echo.
pause
exit /b
 
 | 
 |