2011-02-12 54 views
0

有人可以請指向我的文檔,顯示來自顯示窗口信息的systeminfo命令行工具的輸出嗎?從所有Windows變體的系統信息輸出

在我的Windows XP機器,我得到這個

OS Name:     Microsoft Windows XP Professional 
OS Version:    5.1.2600 Service Pack 3 Build 2600 
OS Manufacturer:   Microsoft Corporation 

操作系統名稱一部分,我需要知道的窗戶儘可能 的儘可能多的版本,我想創建一個在所有Windows版本上執行審計功能的腳本,並且我使用的某些命令是特定於版本的。

除非有更好的方式來disocver Windows版本比使用系統的系統信息

我不想使用WMI,或.net,我試圖讓事情slightweight和儘可能簡單。

謝謝你能聽

乾杯

DD

回答

1

我覺得這是測試的Windows版本在蝙蝠腳本更簡單的方法:

 
@REM -- .bat script code for detecting various windows versions 
@REM h/t to Paul Cramer and Rob van der Woude 
@REM http://www.robvanderwoude.com/ver.php (or webcitation.org/6CTMCq12q) 

@echo on 
if '%OS%' == '' goto win9x 
if '%COMSPEC%' == 'C:\COMMAND.COM' goto win9x 
ver | find "Windows XP" >nul 
if not errorlevel 1 goto WinXP 
ver | find "Vista" >nul 
if not errorlevel 1 goto winVistaOrSvr2008 
ver | find "6.0." >nul 
if not errorlevel 1 goto winVistaOrSvr2008 
ver | find "6.1." >nul 
if not errorlevel 1 goto Win7 
ver | find "6.2.9200" >nul 
if not errorlevel 1 goto Win8orSvr2012 
ver | find "6." >nul 
if not errorlevel 1 goto Win8or7orVista 
ver | find "Windows 2000" >nul 
if not errorlevel 1 goto win2K 
ver | find "Windows 98" >nul 
if not errorlevel 1 goto win9x 
ver | find "Windows 95" >nul 
if not errorlevel 1 goto win9x 
ver | find "Windows Me" >nul 
if not errorlevel 1 goto win9x 
@echo **** Sorry, this script does not support your OS version. This is: 
@ver 
@goto xit 

... 

:xit 
ver | find "6.1.7600" >nul 
@if not errorlevel 1 echo **** Warning! This computer lacks Win7 SP1 **** 
ver | find "6.0.6000" >nul 
@if not errorlevel 1 echo **** Warning! This computer lacks Vista SP1 and SP2 **** 
ver | find "6.0.6001" >nul 
@if not errorlevel 1 echo **** Warning! This computer might lack Vista SP2 **** 
:xit2