c 檢測作業系統版本

2021-09-17 23:30:27 字數 943 閱讀 1234

**:

我們通過system.environment.osversion.version獲得作業系統的版本號,然後再根據版本號進行判斷作業系統是什麼版本

0參考於:

注意:在msdn官方文件有說明 → osversion 屬性報告兩個相同的版本號 (6.2.0.0) windows 8 和 windows 8.1。在某些情況下, osversion 屬性可能不會返回與指定的 windows 程式相容性模式功能的版本相匹配的作業系統版本。

**:

public class getosystem

public getosystem()

console.writeline(osystemname);}}

class program

}

輸出結果:

winform 檢測作業系統版本

網上最常見的版本 但是經親測,已經不准了 window的官方版本號說明和實際情況相差較大 親測有效的版本 下面幾個是我獲取了的幾個版本名稱 microsoft windows 10 企業版 microsoft windows server 2008 r2 enterprise microsoft w...

前端獲取作業系統 作業系統版本

在做埋點的過程中,遇到要上傳作業系統和作業系統版本的需求,如下 通過n igator.useragent獲取首先將作業系統確定為如下對映 all os 獲取當前作業系統 獲取當前作業系統 export const getos if useragent.includes mac else if use...

CMakeLists檢測作業系統

cmakelists檢測作業系統 if cmake system name strequal linux message status configuring on for linux elseif cmake system name strequal darwin message status c...