根据怎么获取操作系统及其版本号

  介绍

这篇文章给大家分享的是有关根据怎么获取操作系统及其版本号的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

根据获取操作系统及其版本号

& # 39; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *   & # 39;* by  r05e   & # 39;*操作系统及其版本号   & # 39;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *   时间=strComputer “!”   Set  objWMIService =, GetObject (“winmgmts:“_   ,,,{impersonationLevel=冒充}! \ \“,,,strComputer ,,“\ \ cimv2"根)   Set  colOperatingSystems =objWMIService.ExecQuery  _   ,(“Select  *,得到Win32_OperatingSystem")   For  Each  objOperatingSystem  colOperatingSystems拷贝   ,Wscript.Echo  objOperatingSystem.Caption ,,,,,,, objOperatingSystem.Version   下一个

根据查询系统信息(名称,版,本系统盘,32 or64) wmi

Function  X86orX64 (),   接下来,提醒Error  Resume =,strComputer “!”   ,Set  objWMIService =, GetObject (“winmgmts: \ \“,,, strComputer ,,“\ \ cimv2"根)   ,Set  colItems =, objWMIService.ExecQuery (“Select  *,得到Win32_ComputerSystem",, 48),   ,For  Each  objItem  colItems拷贝      If 才能;InStr (objItem.SystemType,,“64“), & lt;在0,那么   ,,X86orX64 =,“x64",,   其他的才能   ,,X86orX64 =,“x86"   ,最终获得;如果   ,下一个   ,   最终获得函数   Function  showOsInfo (),   Dim  res   接下来,提醒Error  Resume =,strComputer “!”   ,Set  objWMIService =, GetObject (“winmgmts: \ \“,,, strComputer ,,“\ \ cimv2"根)   ,Set  colItems =, objWMIService.ExecQuery (“Select  *,得到Win32_OperatingSystem",, 48)   ,res =癷nfoStart"   ,For  Each  objItem  colItems拷贝   res =res ,,“_",, objItem.Caption   res =res ,,“_",, objItem.SystemDrive   res =res ,,“_",, objItem.Version   & # 39;WScript.Echo  objItem.OSArchitecture ,   ,下一个   ,   res =res ,,“_",,, X86orX64 (),   res =res ,,“_infoEnd"   WScript.Echo  res   最终获得函数   call  showOsInfo ()   WScript.Echo “完成了!“

cmd +于+ wmi判断系统级别版本和类型

cmd脚本:

@echo    SETLOCAL  ENABLEDELAYEDEXPANSION   rem 本脚本用于确定当前nt5以上框架工作站系统的级别版本和类型,需根据/wmi 支持   在%临时% \ verx.vbs  echo  Set  wmi=GetObject (“winmgmts: \ \ !”)   在祝辞%临时% \ verx.vbs  echo  Set 操作=wmi.instancesof (^“win32_Operatingsystem ^“)   在祝辞%临时% \ verx.vbs  echo  For  Each  sys 拷贝操作   在祝辞%临时% \ verx.vbs  echo ,, WScript.Echo  sys.caption ^,“,“^, sys.Version ^,“,“^, sys.OSArchitecture   祝辞祝辞%临时% \ verx.vbs  echo 其次   set “winver=Unkonw"   for /f “跳过=2,delims=,,令牌=1,2,3,,% % c 拷贝(& # 39;cscript “% % \ temp verx.vbs" & # 39;), do  (   ,echo  c % %, % % % % d, e   ,echo ===========================================================,for /f “delims=只令牌=1,2“,% %小姐:拷贝(“% % d"), do  (   % %:% %,if  j  equ  10.0, set “winver=Win_10"   % %:% %,if  j  equ  6.2, set “winver=Win_8"   % %:% %,if  j  equ  6.1, set “winver=Win_7"   % %:% %,if  j  equ  6.0, set “winver=Win_Vista"   % %:% %,if  j  equ  5.2, set “winver=Win_XP"   % %:% %,if  j  equ  5.1, set “winver=Win_XP"   % %:% %,if  j  equ  5.0, set “winver=Win_2K"   ,)   ,for /f “delims=成功;令牌=1“,% %小姐:拷贝(“% % e"), do  (   ,set “winver=! winver ! % %我;   % %,if 小姐:equ  32, set “winver=! winver: % % i=.x86 !“   % %,if 小姐:equ  64年,set “winver=! winver: % % i=.x64 !“   ,)   )   echo  winver !null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null

根据怎么获取操作系统及其版本号