Stack Overflow 上有关于操作系统版本的问题,但没有关于 Windows 名称的问题,我希望使用 Node.js 找出 Windows 名称。
我研究了很多模块,例如 os
、platform
、getos
和使用 process
等,并且发现这些有助于获取操作系统描述、进程环境等。我也能得到它是 Linux 还是 Windows,即我正在使用哪个平台。
但是,我如何检查使用 Node.js 安装在我的系统上的是 Windows 7 还是 8?
我在我的 Node.js 项目中使用 kinect2
模块,它在 Windows 8 上运行良好,但我希望在 Windows 7 上使用它。
我已经检查过 Kinect2 不适用于 Windows 7。
最佳答案
使用os.release()
.
> os.release();
'10.0.18363'
在 Windows 上,结果的格式为 major.minor.build
查阅此表 ( source ) 以确定 Windows 的版本:
Version major.minor
------------------------------------------ -------------
Windows 10, Windows Server 2016 10.0
Windows 8.1, Windows Server 2012 R2 6.3
Windows 8, Windows Server 2012 6.2
Windows 7, Windows Server 2008 R2 6.1
Windows Vista, Windows Server 2008 6.0
Windows XP Professional x64 Edition, 5.2
Windows Server 2003, Windows Home Server
Windows XP 5.1
Windows 2000 5.0
特别是对于 Windows 10,请查阅此表 (source) 以确定确切的版本:
Version build
----------------- -------
Windows 10 1909 18363
Windows 10 1903 18362
Windows 10 1809 17763
Windows 10 1803 17134
Windows 10 1709 16299
Windows 10 1703 15063
Windows 10 1607 14393
Windows 10 1511 10586
Windows 10 1507 10240
关于javascript - 如何使用 Node.js 获取 Windows 版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42524606/