devcon in verbindung mit batch
Hallo liebe User,
ich bin derzeit auf der Suche nach einem Batch-File, mit dessen Hilfe ich meine WLAN-Karte aktivieren UND deaktivieren kann.
Hierzu habe ich natürlich "devon" im Einsatz und auch bereits einen Code entworfen, der den Status der WLAN-Karte jeweils erkennen soll und genau durch Ausführen der Datei den anderen Zustand (aktiv/inaktiv) herstellen soll. Allerdings funktioniert nur das Aktivieren der Karte. Die Deaktvierung funktioniert NICHT! Meine WLAN-Karte weist 4 Hardware-IDs auf.
@echo off & setlocal
set "Action=disable"
devcon.exe status "PCI\VEN_14E4&DEV_4311&SUBSYS_00071028&REV_01" | findstr "disabled">nul && set "Action=enable"
devcon.exe %Action% "PCI\VEN_14E4&DEV_4311&SUBSYS_00071028&REV_01"
devcon.exe status "PCI\VEN_14E4&DEV_4311&SUBSYS_00071028" | findstr "disabled">nul && set "Action=enable"
devcon.exe %Action% "PCI\VEN_14E4&DEV_4311&SUBSYS_00071028"
devcon.exe status "PCI\VEN_14E4&DEV_4311&CC_028000" | findstr "disabled">nul && set "Action=enable"
devcon.exe %Action% "PCI\VEN_14E4&DEV_4311&CC_028000"
devcon.exe status "PCI\VEN_14E4&DEV_4311&CC_0280" | findstr "disabled">nul && set "Action=enable"
devcon.exe %Action% "PCI\VEN_14E4&DEV_4311&CC_0280"
Kann mir jemand den Fehler nennen?
Vielen Dank.
herschel81
@echo off & setlocal
set "Action=disable"
devcon.exe status "PCI\VEN_14E4&DEV_4311&SUBSYS_00071028&REV_01" | findstr "disabled">nul && set "Action=enable"
devcon.exe %Action% "PCI\VEN_14E4&DEV_4311&SUBSYS_00071028&REV_01"
devcon.exe status "PCI\VEN_14E4&DEV_4311&SUBSYS_00071028" | findstr "disabled">nul && set "Action=enable"
devcon.exe %Action% "PCI\VEN_14E4&DEV_4311&SUBSYS_00071028"
devcon.exe status "PCI\VEN_14E4&DEV_4311&CC_028000" | findstr "disabled">nul && set "Action=enable"
devcon.exe %Action% "PCI\VEN_14E4&DEV_4311&CC_028000"
devcon.exe status "PCI\VEN_14E4&DEV_4311&CC_0280" | findstr "disabled">nul && set "Action=enable"
devcon.exe %Action% "PCI\VEN_14E4&DEV_4311&CC_0280"
Kann mir jemand den Fehler nennen?
Vielen Dank.
herschel81
Please also mark the comments that contributed to the solution of the article
Content-Key: 116611
Url: https://administrator.de/contentid/116611
Printed on: April 25, 2024 at 12:04 o'clock
5 Comments
Latest comment
Das glaube ich nicht so recht. Was zeigt denn der Gerätemanager unter Eigenschaften > Details > Geräteinstanzkennung an?
Hallo herschel81!
Die Zeile
wird nur für eine ID angewandt, abgefragt werden allerdings 4 IDs - senn Du konsequent für jede dieser IDs die "%Action%" ausführst, müsste es auch mit dem Deaktivieren (bzw der Erkennung des Status als Voraussetzung) klappen ...
Ob, wie blablanick zu Recht hinterfragt, tatsächlich alle 4 IDs notwendig / sinnvoll sind, musst Du selbst herausfinden.
Grüße
bastla
Die Zeile
devcon.exe %Action% "PCI\VEN_14E4&DEV_4311&CC_0280"
Ob, wie blablanick zu Recht hinterfragt, tatsächlich alle 4 IDs notwendig / sinnvoll sind, musst Du selbst herausfinden.
Grüße
bastla