【问题标题】:Get windows version from git bash从 git bash 获取 windows 版本
【发布时间】:2019-02-12 21:15:55
【问题描述】:

我试图在 git-bash shell 脚本中确定 windows10 安装的类型(家庭版和专业版):

if [[ ! $(wmic os get caption) = *"Home"* ]];then
    echo "Not using windows home"
fi

然而,一位法国用户刚刚报告了一个错误,即 Windows 版本以本地语言返回,在本例中为“Microsoft Windows 10 Famille”。除了将“Home”翻译成每种语言之外,面对多种语言,是否有更好的方法来确定脚本是在 home 上运行还是在 pro 上运行?

【问题讨论】:

    标签: windows-10 git-bash


    【解决方案1】:

    我发现的一个解决方案是寻找存在于 windows pro 而不是 windows home 上的 bitlocker 作为功能。

    if [[ ! -f /c/Windows/System32/BitLockerWizard.exe ]];then 
        echo "On windows home"
    fi
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-03
      • 2012-11-22
      • 1970-01-01
      • 2019-12-04
      • 2011-12-29
      • 2023-04-05
      • 1970-01-01
      相关资源
      最近更新 更多