1. 程式人生 > >批處理獲取系統版本資訊

批處理獲取系統版本資訊

@echo off
::從系統檔案中獲取系統版本資訊
for /f "tokens=1* delims=[" %%a in ('ver') do set b=%%b
::將版本資訊賦值給變數b
set b=%b:* =%
::呼叫指定值對應的cmd命令列
call:%b:~0,4%%PROCESSOR_ARCHITECTURE:~-1%

@echo off
for /f "tokens=2 delims==" %%a in ('wmic path win32_operatingsystem get LocalDateTime /value') do (  
    set t=%%a
)  
set nowTime=%t:~0,12%
echo,%nowTime%  

pause&exit
:5.1.6
echo 系統版本: winxp_32位
goto:eof
:5.2.6
echo 系統版本: win2003_32位
goto:eof
:5.2.4
echo 系統版本: win2003_64位
goto:eof
:6.1.6
echo 系統版本:win7_32位
goto:eof
:6.1.4
echo 系統版本:win7_64或win2008_64位
goto:eof
:6.2.6
echo 系統版本:win8_32位
goto:eof
:6.2.4
echo 系統版本:win8_64或win2012_64位
goto:eof

pause