[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[系统相关] 求助合并两组批处理让其显示为品牌的英文名称和中文名称

  1. @echo off
  2. for /f "tokens=2 delims==" %%a in ('wmic csproduct get Vendor /value ^| findstr /i "Vendor"') do (
  3.     set "Vendor=%%a"
  4. )
  5. if /i "%Manufacturer:~0,3%" == "MSI" set Manufacturer=微星
  6. if /i "%Manufacturer:~0,4%" == "ASUS" set Manufacturer=华硕
  7. if /i "%Manufacturer:~0,4%" == "TIMI" set Manufacturer=小米
  8. if /i "%Manufacturer:~0,4%" == "SOYO" set Manufacturer=梅捷
  9. if /i "%Manufacturer:~0,4%" == "ONDA" set Manufacturer=昂达
  10. if /i "%Manufacturer:~0,5%" == "SUPOX" set Manufacturer=磐正
  11. if /i "%Manufacturer:~0,5%" == "PCASL" set Manufacturer=翔升
  12. if /i "%Manufacturer:~0,5%" == "INTEL" set Manufacturer=英特尔
  13. if /i "%Manufacturer:~0,6%" == "MAXSUN" set Manufacturer=铭瑄
  14. if /i "%Manufacturer:~0,6%" == "LENOVO" set Manufacturer=联想
  15. if /i "%Manufacturer:~0,6%" == "ASROCK" set Manufacturer=华擎
  16. if /i "%Manufacturer:~0,6%" == "GALAXY" set Manufacturer=影驰
  17. if /i "%Manufacturer:~0,7%" == "TOSHIBA" set Manufacturer=东芝
  18. if /i "%Manufacturer:~0,7%" == "BIOSTAR" set Manufacturer=映泰
  19. if /i "%Manufacturer:~0,8%" == "GIGABYTE" set Manufacturer=技嘉
  20. if /i "%Manufacturer:~0,8%" == "COLORFUL" set Manufacturer=七彩虹
  21. if /i "%Manufacturer:~0,8%" == "SAPPHIRE" set Manufacturer=蓝宝石
  22. if /i "%Manufacturer:~0,8%" == "MECHREVO" set Manufacturer=机械格命
  23. if /i "%Manufacturer:~0,10%" == "SUPERMICRO" set Manufacturer=超微
  24. echo %Vendor%
  25. pause
复制代码
如何显示为这样:
例如:LENOVO(联想)
我是新手,正在学习,请各位大师帮帮忙

本帖最后由 qixiaobin0715 于 2022-1-14 20:48 编辑
  1. @echo off
  2. set var=MSI#微星 ASUS#华硕 TIMI#小米 SOYO#梅捷 ONDA#昂达 SUPOX#磐正 PCASL#翔升 INTEL#英特尔 MAXSUN#铭瑄 LENOVO#联想 ASROCK#华擎 ^
  3. GALAXY#影驰 TOSHIBA#东芝 BIOSTAR#映泰 GIGABYTE#技嘉 COLORFUL#七彩虹 SAPPHIRE#蓝宝石 MECHREVO#机械格命 SUPERMICRO#超微
  4. setlocal enabledelayedexpansion
  5. for %%i in (%var%) do (
  6.     for /f "tokens=1* delims=#" %%j in ("%%i") do set %%j=%%k
  7. )
  8. for /f "tokens=2 delims==- " %%a in ('wmic csproduct get Vendor /value ^| findstr /i "Vendor"') do echo,%%a(!%%a!^)
  9. pause
复制代码

TOP

  1. @echo off
  2. for /f "tokens=2 delims==" %%a in ('wmic csproduct get Vendor /value ^| findstr /i "Vendor"') do (
  3.     set "Vendor=%%a"
  4. )
  5. set "Manufacturer=%Vendor%"
  6. if /i "%Manufacturer:~0,3%" == "MSI" set Manufacturer=微星
  7. if /i "%Manufacturer:~0,4%" == "ASUS" set Manufacturer=华硕
  8. if /i "%Manufacturer:~0,4%" == "TIMI" set Manufacturer=小米
  9. if /i "%Manufacturer:~0,4%" == "SOYO" set Manufacturer=梅捷
  10. if /i "%Manufacturer:~0,4%" == "ONDA" set Manufacturer=昂达
  11. if /i "%Manufacturer:~0,5%" == "SUPOX" set Manufacturer=磐正
  12. if /i "%Manufacturer:~0,5%" == "PCASL" set Manufacturer=翔升
  13. if /i "%Manufacturer:~0,5%" == "INTEL" set Manufacturer=英特尔
  14. if /i "%Manufacturer:~0,6%" == "MAXSUN" set Manufacturer=铭瑄
  15. if /i "%Manufacturer:~0,6%" == "LENOVO" set "Manufacturer=联想" & goto:XXoo
  16. if /i "%Manufacturer:~0,6%" == "ASROCK" set Manufacturer=华擎
  17. if /i "%Manufacturer:~0,6%" == "GALAXY" set Manufacturer=影驰
  18. if /i "%Manufacturer:~0,7%" == "TOSHIBA" set Manufacturer=东芝
  19. if /i "%Manufacturer:~0,7%" == "BIOSTAR" set Manufacturer=映泰
  20. if /i "%Manufacturer:~0,8%" == "GIGABYTE" set Manufacturer=技嘉
  21. if /i "%Manufacturer:~0,8%" == "COLORFUL" set Manufacturer=七彩虹
  22. if /i "%Manufacturer:~0,8%" == "SAPPHIRE" set Manufacturer=蓝宝石
  23. if /i "%Manufacturer:~0,8%" == "MECHREVO" set Manufacturer=机械格命
  24. if /i "%Manufacturer:~0,10%" == "SUPERMICRO" set Manufacturer=超微
  25. :XXoo
  26. echo %Vendor%^(%Manufacturer%^)
  27. pause
复制代码
另if 每行加个goto命令会运行快些
“阿姐走了。。。可是。。。我。。。我愿意。”

TOP

返回列表