{"id":8942,"date":"2021-11-30T10:36:16","date_gmt":"2021-11-30T10:36:16","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=8942"},"modified":"2021-11-30T10:36:40","modified_gmt":"2021-11-30T10:36:40","slug":"bat-script-parsing-a-variable-with-a-for-command","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/bat-script-parsing-a-variable-with-a-for-command\/28878.html","title":{"rendered":"Bat Script &#8211; Parsing A Variable With A For Command"},"content":{"rendered":"<p>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<\/p>\n<p>FOR \/F &#8220;tokens=2 delims==&#8221; %%i IN (&#8216;wmic path win32_videocontroller get pnpdeviceid\/value 2^&gt;NUL ^| find \/i &#8220;pnpdeviceid&#8221;&#8216;) DO set vdcd=%%i<\/p>\n<p>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<\/p>\n<p>FOR \/F &#8220;tokens=2 delims==&#8221; %%i IN (&#8216;wmic path win32_videocontroller Where DeviceID=&#8221;VideoController1&#8243; get pnpdeviceid \/value 2^&gt;NUL ^| find \/i &#8220;pnpdeviceid&#8221;&#8216;) DO set vdcd=%%i<\/p>\n<p>Running just<br \/>\nwmic path win32_videocontroller Where DeviceID=&#8221;VideoController1&#8221; get pnpdeviceid<br \/>\ndoes result with the desired primary display adapter. I can make a mess of things and &#8220;MAKE&#8221; 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.<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":7},"question-category":[55],"question_tags":[],"class_list":["post-8942","question","type-question","status-publish","hentry","question-category-programming"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/8942","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=8942"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=8942"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=8942"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=8942"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}