通过cmd.exe的按本来判断- @echo off
- for %%i in (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\cmd.exe wmic datafile where "name='%%i:\\windows\\system32\\cmd.exe'" get version>>a.tmp&&if exist %%i:\windows\SysWOW64\ (
- echo %%i盘是64位>>pan.tmp
- ) else (
- echo %%i盘是32位>>pan.tmp
- )
- )
- setlocal enabledelayedexpansion
- (for /f "delims=" %%a in ('type a.tmp') do (
- set "line=%%a"
- set "line=!line: =!"
- echo !line!
- ))>b.tmp
- findstr /v "Version" "b.tmp">>c.tmp
- setlocal enabledelayedexpansion
- for /f "delims=" %%a in (c.tmp) do (
- set num=%%a
- set var=!num:~0,3!
- echo.!var! >>ver.tmp
- )
- for /f %%m in (ver.tmp) do (
- if %%m==5.1 echo xp>>sys.tmp
- if %%m==6.1 echo win7sp1>>sys.tmp
- if %%m==5.2 echo win2003>>sys.tmp
- if %%m==6.0 echo win2008>>sys.tmp
- if %%m==6.2 echo win8>>sys.tmp
- if %%m==6.3 echo win8.1>>sys.tmp
- if %%m==10. echo win10>>sys.tmp
- )
- set n=0
- for /f "tokens=*" %%a in (pan.tmp) do (set /a n+=1
- set a!n!=%%a
- set x=!n!)
- set n=0
- for /f "tokens=*" %%b in (sys.tmp) do (set /a n+=1
- set b!n!=%%b)
- for /l %%c in (1,1,%x%) do (if defined b%%c echo !a%%c!!b%%c!>>系统.txt)
- del *.tmp
复制代码 通过挂载注册表来读取- @echo off
- set "v1=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
- set "v2=HKLM\My_Hive\Microsoft\Windows NT\CurrentVersion"
- set "Hive=windows\system32\config\software"
- for %%i in (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 /i "%%i:"=="%SystemDrive%" (
- for /f "tokens=1,2*" %%a in ('reg query "%v1%"') do (
- if /i "%%a"=="ProductName" (
- if exist "%%i:\windows\SysWOW64" (
- echo,分区:%%i
- echo,系统:%%c x64&echo,
- ) else (
- echo,分区:%%i
- echo,系统:%%c x86&echo,
- )
- )
- )
- ) else if exist "%%i:\%Hive%" (
- reg load "HKLM\My_Hive" "%%i:\%Hive%" >nul
- for /f "tokens=1,2*" %%a in ('reg query "%v2%"') do (
- if /i "%%a"=="ProductName" (
- if exist "%%i:\windows\SysWOW64" (
- echo,分区:%%i
- echo,系统:%%c x64&echo,
- ) else (
- echo,分区:%%i
- echo,系统:%%c x86&echo,
- )
- )
- )
- reg unload "HKLM\My_Hive" >nul
- )
- )
- pause
复制代码
|