标题: [系统相关] 求助合并两组批处理让其显示为品牌的英文名称和中文名称 [打印本页]
作者: 反璞归真 时间: 2022-1-13 11:23 标题: 求助合并两组批处理让其显示为品牌的英文名称和中文名称
- @echo off
- for /f "tokens=2 delims==" %%a in ('wmic csproduct get Vendor /value ^| findstr /i "Vendor"') do (
- set "Vendor=%%a"
- )
- if /i "%Manufacturer:~0,3%" == "MSI" set Manufacturer=微星
- if /i "%Manufacturer:~0,4%" == "ASUS" set Manufacturer=华硕
- if /i "%Manufacturer:~0,4%" == "TIMI" set Manufacturer=小米
- if /i "%Manufacturer:~0,4%" == "SOYO" set Manufacturer=梅捷
- if /i "%Manufacturer:~0,4%" == "ONDA" set Manufacturer=昂达
- if /i "%Manufacturer:~0,5%" == "SUPOX" set Manufacturer=磐正
- if /i "%Manufacturer:~0,5%" == "PCASL" set Manufacturer=翔升
- if /i "%Manufacturer:~0,5%" == "INTEL" set Manufacturer=英特尔
- if /i "%Manufacturer:~0,6%" == "MAXSUN" set Manufacturer=铭瑄
- if /i "%Manufacturer:~0,6%" == "LENOVO" set Manufacturer=联想
- if /i "%Manufacturer:~0,6%" == "ASROCK" set Manufacturer=华擎
- if /i "%Manufacturer:~0,6%" == "GALAXY" set Manufacturer=影驰
- if /i "%Manufacturer:~0,7%" == "TOSHIBA" set Manufacturer=东芝
- if /i "%Manufacturer:~0,7%" == "BIOSTAR" set Manufacturer=映泰
- if /i "%Manufacturer:~0,8%" == "GIGABYTE" set Manufacturer=技嘉
- if /i "%Manufacturer:~0,8%" == "COLORFUL" set Manufacturer=七彩虹
- if /i "%Manufacturer:~0,8%" == "SAPPHIRE" set Manufacturer=蓝宝石
- if /i "%Manufacturer:~0,8%" == "MECHREVO" set Manufacturer=机械格命
- if /i "%Manufacturer:~0,10%" == "SUPERMICRO" set Manufacturer=超微
- echo %Vendor%
- pause
复制代码
如何显示为这样:
例如:LENOVO(联想)
我是新手,正在学习,请各位大师帮帮忙
作者: hfg1977 时间: 2022-1-13 15:50
- @echo off
- for /f "tokens=2 delims==" %%a in ('wmic csproduct get Vendor /value ^| findstr /i "Vendor"') do (
- set "Vendor=%%a"
- )
- set "Manufacturer=%Vendor%"
- if /i "%Manufacturer:~0,3%" == "MSI" set Manufacturer=微星
- if /i "%Manufacturer:~0,4%" == "ASUS" set Manufacturer=华硕
- if /i "%Manufacturer:~0,4%" == "TIMI" set Manufacturer=小米
- if /i "%Manufacturer:~0,4%" == "SOYO" set Manufacturer=梅捷
- if /i "%Manufacturer:~0,4%" == "ONDA" set Manufacturer=昂达
- if /i "%Manufacturer:~0,5%" == "SUPOX" set Manufacturer=磐正
- if /i "%Manufacturer:~0,5%" == "PCASL" set Manufacturer=翔升
- if /i "%Manufacturer:~0,5%" == "INTEL" set Manufacturer=英特尔
- if /i "%Manufacturer:~0,6%" == "MAXSUN" set Manufacturer=铭瑄
- if /i "%Manufacturer:~0,6%" == "LENOVO" set "Manufacturer=联想" & goto:XXoo
- if /i "%Manufacturer:~0,6%" == "ASROCK" set Manufacturer=华擎
- if /i "%Manufacturer:~0,6%" == "GALAXY" set Manufacturer=影驰
- if /i "%Manufacturer:~0,7%" == "TOSHIBA" set Manufacturer=东芝
- if /i "%Manufacturer:~0,7%" == "BIOSTAR" set Manufacturer=映泰
- if /i "%Manufacturer:~0,8%" == "GIGABYTE" set Manufacturer=技嘉
- if /i "%Manufacturer:~0,8%" == "COLORFUL" set Manufacturer=七彩虹
- if /i "%Manufacturer:~0,8%" == "SAPPHIRE" set Manufacturer=蓝宝石
- if /i "%Manufacturer:~0,8%" == "MECHREVO" set Manufacturer=机械格命
- if /i "%Manufacturer:~0,10%" == "SUPERMICRO" set Manufacturer=超微
- :XXoo
- echo %Vendor%^(%Manufacturer%^)
- pause
复制代码
另if 每行加个goto命令会运行快些
作者: qixiaobin0715 时间: 2022-1-14 09:34
本帖最后由 qixiaobin0715 于 2022-1-14 20:48 编辑
- @echo off
- set var=MSI#微星 ASUS#华硕 TIMI#小米 SOYO#梅捷 ONDA#昂达 SUPOX#磐正 PCASL#翔升 INTEL#英特尔 MAXSUN#铭瑄 LENOVO#联想 ASROCK#华擎 ^
- GALAXY#影驰 TOSHIBA#东芝 BIOSTAR#映泰 GIGABYTE#技嘉 COLORFUL#七彩虹 SAPPHIRE#蓝宝石 MECHREVO#机械格命 SUPERMICRO#超微
- setlocal enabledelayedexpansion
- for %%i in (%var%) do (
- for /f "tokens=1* delims=#" %%j in ("%%i") do set %%j=%%k
- )
- for /f "tokens=2 delims==- " %%a in ('wmic csproduct get Vendor /value ^| findstr /i "Vendor"') do echo,%%a(!%%a!^)
- pause
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |