回复 4# flashercs
谢谢大佬,可以正常取值。这个代码主要是用来安装显卡驱动的,由于技嘉主板CPU带核显的情况下,会显示2个显卡选项,所以之前的代码默认只打了核显驱动,没有打独显。
我这边用创建第三方文件的方法,也得到了解决。后面我看下把您的和我的合并一下一起处理。- @echo off & setlocal EnableDelayedExpansion
- @cd /d "%~dp0"
- if exist gpuz.xml (del gpuz.xml)
- if exist ")" (del ")")
- call GPU-Z.exe -dump GPUZ.xml
- for /f %%a in ('type "GPUZ.xml" ^|find /c /i "<cardname>Microsoft </cardname>"') do set "nums=%%a"
- if %nums% EQU 1 (call :Cari)
- for /f "skip=1 tokens=1 delims=:" %%a in ('type "GPUZ.xml" ^|findstr /n "<cardname>Microsoft </cardname>"') do set "kas=%%a" & set /a ka2=!kas!-3
- echo %ka2%
-
- :Cari
- for /f "delims=^> tokens=1,*" %%a in ('type "GPUZ.xml" ^|find "<gpuname>"') do (for /f "delims=^< tokens=1,*" %%c in ("%%b") do set gpuname=%%c)
- for /f "delims=^> tokens=1,*" %%a in ('type "GPUZ.xml" ^|find "<vendorid>"') do (for /f "delims=^< tokens=1,*" %%c in ("%%b") do set vendorid=%%c)
- for /f "delims=^> tokens=1,*" %%a in ('type "GPUZ.xml" ^|find "<deviceid>"') do (for /f "delims=^< tokens=1,*" %%c in ("%%b") do set deviceid=%%c)
- for /f "delims=^> tokens=1,*" %%a in ('type "GPUZ.xml" ^|find "<subvendorid>"') do (for /f "delims=^< tokens=1,*" %%c in ("%%b") do set subvendorid=%%c)
- for /f "delims=^> tokens=1,*" %%a in ('type "GPUZ.xml" ^|find "<subsysid>"') do (for /f "delims=^< tokens=1,*" %%c in ("%%b") do set subsysid=%%c)
-
- echo %vendorid% %deviceid%-%subvendorid% %subsysid%
- echo %gpuname%
-
- set Cars=1
- :installDrive
-
- ::10400 Comet Lake GT2
- if "%gpuname%"=="Intel Xe" (start /min "" ".\DG1\DVrun.bat" & Goto End)
- if "%gpuname%"=="Arc Alchemist" (start /min "" ".\A380\DVrun.bat" & Goto End)
- if "%gpuname%"=="Alder Lake" (start /min "" ".\Intel_Video\DvRun.bat" & Goto End)
- if "%vendorid%"=="8086" (start /min "" ".\Intel_Video\DvRun.bat" & Goto End)
-
- if "%vendorid%"=="1002" (echo 我是AMD显卡 & start /min "" ".\AMD580\DvRun.bat" & Goto End)
-
- if "%gpuname%"=="GK208" (echo 我是NVIDIAGT710显卡 & start /min "" ".\NV710\DvRun.bat" & Goto End)
- if "%gpuname%"=="GK208B" (echo 我是NVIDIAGT710显卡 & start /min "" ".\NV710\DvRun.bat" & Goto End)
- if "%gpuname%"=="GF119" (echo 我是NVIDIAGT710显卡 & start /min "" ".\NV710\DvRun.bat" & Goto End)
- if "%gpuname%"=="GF108" (echo 我是NVIDIAGT730显卡 & start /min "" ".\NV710\DvRun.bat" & Goto End)
- if "%gpuname%"=="GK208B" (echo 我是NVIDIAGT730显卡 & start /min "" ".\NV710\DvRun.bat" & Goto End)
-
- ::T600 T400 T1000
- if "%vendorid% %deviceid%-%subvendorid% %subsysid%"=="10DE 1FB1-10DE 1488" (echo 我是NVIDIAT600显卡 & start /min "" ".\NVT400\DvRun.bat" & Goto End)
- if "%vendorid% %deviceid%-%subvendorid% %subsysid%"=="10DE 1FB2-10DE 1489" (echo 我是NVIDIAT400显卡 & start /min "" ".\NVT400\DvRun.bat" & Goto End)
- if "%vendorid% %deviceid%-%subvendorid% %subsysid%"=="10DE 1FB0-103C 12DB" (echo 我是NVIDIAT1000显卡 & start /min "" ".\NVT400\DvRun.bat" & Goto End)
- if "%gpuname%"=="GA106" (echo 我是NVIDIAA2000显卡 & start /min "" ".\NVT400\DvRun.bat" & Goto End)
- if "%gpuname%"=="GP106" (echo 我是NVIDIAP2000显卡 & start /min "" ".\NVT400\DvRun.bat" & Goto End)
- ::P1000 P620 P400
- if "%gpuname%"=="GP107" (echo 我是NVIDIAP620显卡 & start /min "" ".\NVT400\DvRun.bat" & Goto End)
-
- if "%vendorid%"=="10DE" (echo 我是NVIDIA游戏显卡 & start /min "" ".\NV3050\DvRun.bat" & Goto End)
- :End
- if !Cars! EQU 2 (call :Qlzc)
- if !nums! EQU 2 (call :Carii)
- :Qlzc
- if exist gpuz.xml (del gpuz.xml)
- if exist GPUZ2.xml (del GPUZ2.xml)
- if exist ")" (del ")")
- exit
-
- :Carii
- (for /f "tokens=*" %%n in (GPUZ.xml) do (
- set /a m+=1
- if !m! LEQ !ka2! (echo %%n)
- )) >GPUZ2.xml
- for /f "delims=^> tokens=1,*" %%a in ('type "GPUZ2.xml" ^|find "<gpuname>"') do (for /f "delims=^< tokens=1,*" %%c in ("%%b") do set gpuname=%%c)
- for /f "delims=^> tokens=1,*" %%a in ('type "GPUZ2.xml" ^|find "<vendorid>"') do (for /f "delims=^< tokens=1,*" %%c in ("%%b") do set vendorid=%%c)
- for /f "delims=^> tokens=1,*" %%a in ('type "GPUZ2.xml" ^|find "<deviceid>"') do (for /f "delims=^< tokens=1,*" %%c in ("%%b") do set deviceid=%%c)
- for /f "delims=^> tokens=1,*" %%a in ('type "GPUZ2.xml" ^|find "<subvendorid>"') do (for /f "delims=^< tokens=1,*" %%c in ("%%b") do set subvendorid=%%c)
- for /f "delims=^> tokens=1,*" %%a in ('type "GPUZ2.xml" ^|find "<subsysid>"') do (for /f "delims=^< tokens=1,*" %%c in ("%%b") do set subsysid=%%c)
- echo %vendorid% %deviceid%-%subvendorid% %subsysid%
- echo %gpuname%
- set /a Cars=!Cars!+1
- call :installDrive
复制代码
|