小編今天要來教大家的是如何透過批次檔,判斷作業系統是Windows 10的哪一個版本。
先建立一個副檔名為bat的批次檔。
檔案內容如下:
@echo off
Wmic OS Get Caption | Find /i “Windows 10” >nul && Goto Win10
msg * /server:127.0.0.1 “該系統不是windows 10”
exit
:Win10
Reg Query “HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion” /v ReleaseId | Find /i “2009” >nul && Goto Win1020H2
Reg Query “HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion” /v ReleaseId | Find /i “2004” >nul && Goto Win102004
Reg Query “HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion” /v ReleaseId | Find /i “1909” >nul && Goto Win101909
Reg Query “HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion” /v ReleaseId | Find /i “1809” >nul && Goto Win101809
Reg Query “HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion” /v ReleaseId | Find /i “1803” >nul && Goto Win101803
exit
:Win1020H2
msg * /server:127.0.0.1 “windows 10 20H2版本”
exit
:Win102004
msg * /server:127.0.0.1 “windows 10 2004版本”
exit
:Win101909
msg * /server:127.0.0.1 “windows 10 1909版本”
exit
:Win101809
msg * /server:127.0.0.1 “windows 10 1809版本”
exit
:Win101803
msg * /server:127.0.0.1 “windows 10 1803版本”
exit
批次檔執行的結果如下圖所示: