小编Eri*_*son的帖子

Windows 批处理:查询 wmic 计算机系统获取模型,如果等于 true 继续 Windows 批处理

希望编写一个脚本来查询 wmic 计算机系统获取模型,如果该值是 true 则继续使用批处理文件如果不是 true echo 不兼容的系统退出,这就是我到目前为止所拥有的

    @echo off

        for /F "skip=1" %%? in ('wmic computersystem get model') do "(

      if %%?' equ Test' ('goto start') else (

      if %%?' equ test1' ('goto start') else (

      if %%?' equ test2' ('goto start') else (

      if %%?' equ test3' ('goto start') else (

      echo un-compatible System Exiting...>nul)))))"

:start

start of script
Run Code Online (Sandbox Code Playgroud)

我通常对脚本编写没问题,但从未使用过 if 语句,所以在这个方面有点迷失。

任何帮助都将受到非常欢迎。

windows batch-file wmic

1
推荐指数
1
解决办法
7132
查看次数

标签 统计

batch-file ×1

windows ×1

wmic ×1