I am trying to write a script to install the correct display driver. Long story short on newer systems when you add a dedicated card the onboard is no longer disabled so when I run this command:
FOR /F "tokens=2 delims==" %%i IN ('wmic path win32_videocontroller get pnpdeviceid/value 2^>NUL ^| find /i "pnpdeviceid"') DO set vdcd=%%i
my vdcd variable is now set with the pnpdeviceid of the onboard, but when I add the wmic Where verb i get no result using this command:
FOR /F "tokens=2 delims==" %%i IN ('wmic path win32_videocontroller Where DeviceID="VideoController1" get pnpdeviceid /value 2^>NUL ^| find /i "pnpdeviceid"') DO set vdcd=%%i
Running just
wmic path win32_videocontroller Where DeviceID="VideoController1" get pnpdeviceid
does result with the desired primary display adapter. I can make a mess of things and "MAKE" it work but I like to keep my scripts as clean as possible.. Making it work by writing the simple command to a txt file and then running a separate for command to read the txt document.
A user on another site suggested I try this as a workaround
@echo off
wmic path win32_videocontroller get deviceid, pnpdeviceid | for /f "tokens=2" %%a in ('find /i "videocontroller1"') do set x=%%a
echo %x%
pause
but I get an output of this
G:\Drivers\Display>set x=PCI\VEN_10DE&DEV_104A&SUBSYS_35451458&REV_A1\4&14466D94
&0&0008
ECHO is off.
Press any key to continue . . .
for some reason at the do set x=%%a
it is instead echoing set x=%%a
and not setting a value at all... very strange indeed...
Any ideas (other then "use a different language", which was also suggested)?