|
4#
楼主 |
发表于 2018-10-25 13:55:42
|
只看该作者
谢谢楼上两位指导,已解决。
- @echo off
- color 1f
- echo.
- echo.
- echo c盘系统版本:
- echo.
- set vc=0
- if not exist "c:\boot\bcd" echo winxp && set vc=1
- if exist "c:\Windows\WinSxs\*.7600.*" echo win7 && set vc=1
- if exist "c:\Windows\WinSxs\*.9200.*" echo win8 && set vc=1
- if exist "c:\Windows\WinSxs\*.9600.*" echo win8.1 && set vc=1
- if "%vc%" == "0" echo win10
- pause >nul
复制代码
--------------------------------------------------------
请问nttwqz大师,只查看多系统版本,能不能修改一下在正常系统中也可运行?
- @echo off
- color 1f
- :: 完成日期:2017-9-15
- if /i not "%systemdrive%"=="X:" if not exist X:\Windows\System32\config\system color 1f & echo 仅支持 WinPE 环境运行... & echo; & pause & exit
- rem 查找所有系统盘盘符、系统名称、类型、版本号
- setlocal enabledelayedexpansion
- for /d %%a in (C D E F G H I J K L M N O P Q R S T U V W Y Z) do if exist %%a:\Windows\System32\config\system set /a n+=1 && set "sysdrive-!n!=%%a:"
- cls
- echo.
- echo 系统列表
- echo;─┬──┬─┬──┬─────────────────────────────
- for /l %%b in (1,1,!n!) do (
- if /i not "%systemdrive%"=="!sysdrive-%%b!" (
- set reg_load_system_%%b=HKLM\temp_system_%%b
- set reg_load_software_%%b=HKLM\temp_software_%%b
- rem 加载注册表 SYSTEM 到HKLM\temp_system_%%b,SOFTWARE到HKLM\temp_software_%%b
- reg load "!reg_load_system_%%b!" !sysdrive-%%b!\Windows\System32\config\SYSTEM >nul 2>&1
- reg load "!reg_load_software_%%b!" !sysdrive-%%b!\Windows\System32\config\SOFTWARE >nul 2>&1
- rem 查询系统类型
- if exist !sysdrive-%%b!\Windows\SysWOW64 (set osarch-%%b=x64) else if not exist !sysdrive-%%b!\Windows\SysWOW64 (set osarch-%%b=x86) else set "osarch-%%b=???"
- )
- rem 查询系统版本号,
- for /f "tokens=3" %%c in ('reg query "!reg_load_system_%%b!\Setup\Service Reporting API\Components\CoreOS" /v Version 2^>nul ^| findstr /i "REG_SZ"') do set ver-%%b=%%c
- rem 如果上面未查询到版本号,则在此处查询
- if not defined ver-%%b (
- for /f "tokens=3" %%f in ('reg query "!reg_load_software_%%b!\Microsoft\Windows NT\CurrentVersion" /v CurrentVersion 2^>nul ^| findstr /i "REG_SZ"') do set ver-%%b=%%f
- for /f "tokens=3" %%g in ('reg query "!reg_load_software_%%b!\Microsoft\Windows NT\CurrentVersion" /v CurrentBuildNumber 2^>nul ^| findstr /i "REG_SZ"') do set ver-%%b=!ver-%%b!.%%g
- )
- rem 查询系统名称
- for /f "tokens=3*" %%d in ('reg query "!reg_load_software_%%b!\Microsoft\Windows NT\CurrentVersion" /v ProductName 2^>nul ^| findstr /i "REG_SZ"') do set name-%%b=%%d %%e
- rem 卸载加载的注册表
- reg unload "!reg_load_system_%%b!" >nul 2>&1
- reg unload "!reg_load_software_%%b!" >nul 2>&1
- echo; %%b│盘符│!sysdrive-%%b!│系统│!name-%%b! !osarch-%%b! ^(!ver-%%b!^)
- if %%b==!n! (echo;─┴──┴─┴──┴─────────────────────────────) else (
- echo;─┼──┼─┼──┼─────────────────────────────
- )
- )
- pause >nul
复制代码 |
|