Bagikan melalui


Contoh Konsol Perangkat (DevCon.exe)

This article provides examples to demonstrate various Device Console (DevCon.exe) commands, including hardware identifiers (IDs), classes, driver files, installing and scanning, and more.

Important

Administrators are recommended to use the PnPUtil command line tool rather than the Device Console sample. Alat PnPUtil dikirim dengan setiap rilis Windows dan memanfaatkan API yang paling andal dan aman yang tersedia. Untuk informasi selengkapnya tentang menggunakan PnPutil alih-alih Konsol Perangkat, lihat Mengganti Konsol Perangkat.

Example categories

The article provides examples for the following categories of Device Console commands, or DevCon for short.

Category Examples
HwIDs Contoh 1: Temukan semua ID
perangkat kerasContoh 2: Menemukan ID perangkat keras dengan menggunakan pola
Contoh 3: Menemukan ID perangkat keras dengan menggunakan kelas
Classes Contoh 4: Mencantumkan kelas di komputer lokal
ListClass Contoh 6: Mencantumkan perangkat di kelas
penyiapan perangkatContoh 7: Mencantumkan perangkat di beberapa kelas
DriverFiles Contoh 8: Mencantumkan semua file
driverContoh 9: Mencantumkan file driver perangkat tertentu
DriverNodes Contoh 10: Mencantumkan paket driver berdasarkan pola
ID perangkat kerasContoh 11: Mencantumkan paket driver berdasarkan pola ID instans perangkat
Resources Contoh 12: Mencantumkan sumber daya kelas perangkat
Contoh 13: Mencantumkan sumber daya perangkat berdasarkan ID
Stack Contoh 14: Menampilkan tumpukan driver untuk perangkat
penyimpananContoh 15: Menemukan kelas penyiapan perangkat
Contoh 16: Menampilkan tumpukan untuk perangkat terkait
Status Contoh 17: Menampilkan status semua perangkat di komputer
lokalContoh 18: Menampilkan status perangkat menurut ID
instans perangkatContoh 19: Menampilkan status perangkat terkait
Find Contoh 20: Menemukan perangkat berdasarkan pola
ID perangkat kerasContoh 21: Menemukan perangkat berdasarkan ID instans perangkat atau kelas
FindAll Contoh 22: Temukan (dan temukan semua) perangkat di kelas pengaturan
ClassFilter Contoh 23: Menampilkan driver filter untuk kelas
penyiapanContoh 24: Menambahkan driver filter ke kelas
penyiapanContoh 25: Menyisipkan driver filter di daftar
kelasContoh 26: Mengganti driver
filterContoh 27: Mengubah urutan driver filter
Enable Contoh 28: Mengaktifkan perangkat
tertentuContoh 29: Mengaktifkan perangkat menurut kelas
Disable Contoh 30: Menonaktifkan perangkat dengan pola
IDContoh 31: Menonaktifkan perangkat berdasarkan ID instans perangkat
Update dan UpdateNI Contoh 32: Memperbarui driver untuk port
komunikasiContoh 44: Memperbarui lapisan abstraksi perangkat keras (HAL) secara paksa
Install Contoh 33: Menginstal perangkat
Contoh 34: Menginstal perangkat dengan menggunakan penyiapan tanpa pengawas
Remove Contoh 35: Menghapus perangkat berdasarkan pola
ID instans perangkatContoh 36: Menghapus perangkat jaringan tertentu
Rescan Contoh 37: Memindai komputer untuk perangkat baru
Restart Contoh 38: Memulai ulang perangkat
Reboot Contoh 39: Mulai Ulang komputer lokal
SetHwID Contoh 40: Menetapkan ID perangkat keras ke perangkat
warisanContoh 41: Menambahkan ID perangkat keras ke semua perangkat
warisanContoh 42: Menghapus ID perangkat keras dari semua perangkat
warisanContoh 43: Menambahkan, menghapus, dan mengganti ID
perangkat kerasContoh 44: Memperbarui HAL secara paksa
dp_add, dp_deleted, dp_enum Contoh 45: Menambahkan dan menghapus paket driver

Example details

Contoh DevCon lengkap disediakan di bagian berikut.

Contoh 1: Temukan semua ID perangkat keras

Operasi DevCon menggunakan ID dan pola ID untuk mengidentifikasi perangkat. Akibatnya, langkah pertama umum untuk menggunakan DevCon adalah membuat file referensi ID perangkat keras untuk perangkat di komputer.

The following command uses the DevCon HwIDs operation, which returns the IDs and the device description. Perintah menggunakan karakter kartubebas tanda bintang (*) untuk mewakili semua perangkat di komputer lokal.

devcon hwids *

Karena outputnya panjang dan digunakan berulang kali, simpan output dalam file teks untuk referensi.

Perintah berikut memperluas perintah sebelumnya dengan karakter pengalihan (>). The redirection saves the command output in the specified file, hwids.txt.

devcon hwids * > hwids.txt

Contoh 2: Menemukan ID perangkat keras dengan menggunakan pola

Untuk menemukan ID perangkat keras perangkat tertentu, masukkan salah satu nilai berikut dengan perintah :

  • ID atau pola perangkat keras
  • ID atau pola yang kompatibel
  • ID atau pola instans perangkat
  • Nama kelas penyiapan perangkat

The following command uses the DevCon HwIDs operation and a pattern to find the hardware IDs of the floppy disk drive on the computer. (Pengguna mengasumsikan bahwa pola muncul di salah satu ID perangkat.) Perintah menggunakan karakter kartubebas (*) untuk mewakili semua karakter yang mungkin mendahului atau mengikuti kata floppy di salah satu ID.

devcon hwids *floppy*

Sebagai respons, DevCon menampilkan ID instans perangkat, ID perangkat keras, dan ID yang kompatibel dari drive disket di komputer. Anda dapat menggunakan ID ini dalam perintah DevCon berikutnya.

FDC\GENERIC_FLOPPY_DRIVE\5&39194F6D&0&0
    Name: Floppy disk drive
    Hardware ID's:
        FDC\GENERIC_FLOPPY_DRIVE
    Compatible ID's:
        GenFloppyDisk
1 matching device(s) found.

Dalam contoh ini, frasa "floppy" terjadi di ID perangkat keras atau ID yang kompatibel hanya dari satu perangkat di komputer. Jika frasa terjadi dalam ID lebih dari satu perangkat, semua perangkat dengan frasa "floppy" dalam ID mereka muncul dalam output.

Contoh 3: Menemukan ID perangkat keras dengan menggunakan kelas

The following command uses the DevCon HwIDs operation and a device setup class to find the hardware IDs of all devices in the Ports device setup class. Simbol sama dengan (=) yang mendahului nama kelas menunjukkan bahwa nilai yang ditentukan adalah kelas dan bukan ID.

devcon hwids =ports

Sebagai respons, DevCon menampilkan ID perangkat keras dan ID yang kompatibel dari tiga perangkat di kelas penyiapan Port:

ACPI\PNP0401\4&B4063F4&0
    Name: ECP Printer Port (LPT1)
    Hardware ID's:
        ACPI\PNP0401
        *PNP0401
ACPI\PNP0501\1
    Name: Communications Port (COM1)
    Hardware ID's:
        ACPI\PNP0501
        *PNP0501
ACPI\PNP0501\2
    Name: Communications Port (COM2)
    Hardware ID's:
        ACPI\PNP0501
        *PNP0501
3 matching device(s) found.

Contoh 4: Mencantumkan kelas di komputer lokal

Karena operasi DevCon dapat menggunakan kelas penyiapan perangkat untuk mengidentifikasi perangkat, sangat berguna untuk membuat file referensi kelas penyiapan perangkat perangkat di komputer.

The following command uses the DevCon Classes operation, which returns a list and description of all classes on the computer.

devcon classes

Karena outputnya panjang dan digunakan berulang kali, simpan output dalam file teks untuk referensi.

Perintah berikut menampilkan semua kelas perangkat pada komputer. It uses the redirection character (>) to save the command output in the specified file, classes.txt.

devcon classes > classes.txt

Contoh 6: Mencantumkan perangkat di kelas penyiapan perangkat

The following command uses the DevCon ListClass operation to list the devices in Net, the device setup class for network adapters.

devcon listclass net

Sebagai respons, DevCon menampilkan ID instans perangkat dan deskripsi setiap perangkat di kelas penyiapan Net:

Listing 6 device(s) for setup class "Net" (Network adapters).
PCI\VEN_10B7&DEV_9200&SUBSYS_00BE1028&REV_78\4&BB7B4AE&0&60F0: 3Com 3C920 Integrated Fast Ethernet Controller (3C905C-TX Compatible)
ROOT\MS_L2TPMINIPORT\0000                                   : WAN Miniport (L2TP)
ROOT\MS_NDISWANIP\0000                                      : WAN Miniport (IP)
ROOT\MS_PPPOEMINIPORT\0000                                  : WAN Miniport (PPPOE)
ROOT\MS_PPTPMINIPORT\0000                                   : WAN Miniport (PPTP)
ROOT\MS_PTIMINIPORT\0000                                    : Direct Parallel

Meskipun respons perintah menarik, itu tidak menyediakan ID perangkat keras perangkat di kelas penyiapan Net.

The following command uses the DevCon HwIDs operation to list the devices in the Net setup class. In a DevCon HwIDs command, the equals symbol (=) precedes the value to indicate that the value is a class and not an ID.

devcon hwids =net

Tampilan yang dihasilkan mencantumkan perangkat di kelas Net dan menyertakan ID instans perangkat, ID perangkat keras, dan ID perangkat yang kompatibel di kelas .

PCI\VEN_10B7&DEV_9200&SUBSYS_00BE1028&REV_78\4&BB7B4AE&0&60F0
    Name: 3Com 3C920 Integrated Fast Ethernet Controller (3C905C-TX Compatible)
    Hardware ID's:
        PCI\VEN_10B7&DEV_9200&SUBSYS_00BE1028&REV_78
        PCI\VEN_10B7&DEV_9200&SUBSYS_00BE1028
        PCI\VEN_10B7&DEV_9200&CC_020000
        PCI\VEN_10B7&DEV_9200&CC_0200
    Compatible ID's:
        PCI\VEN_10B7&DEV_9200&REV_78
        PCI\VEN_10B7&DEV_9200
        PCI\VEN_10B7&CC_020000
        PCI\VEN_10B7&CC_0200
 PCI\VEN_10B7
        PCI\CC_020000
 PCI\CC_0200
ROOT\MS_L2TPMINIPORT\0000
    Name: WAN Miniport (L2TP)
    Hardware ID's:
        ms_l2tpminiport
ROOT\MS_NDISWANIP\0000
    Name: WAN Miniport (IP)
    Hardware ID's:
        ms_ndiswanip
ROOT\MS_PPPOEMINIPORT\0000
    Name: WAN Miniport (PPPOE)
    Hardware ID's:
        ms_pppoeminiport
ROOT\MS_PPTPMINIPORT\0000
    Name: WAN Miniport (PPTP)
    Hardware ID's:
        ms_pptpminiport
ROOT\MS_PTIMINIPORT\0000
    Name: Direct Parallel
    Hardware ID's:
        ms_ptiminiport
6 matching device(s) found.

Contoh 7: Mencantumkan perangkat di beberapa kelas

The following command uses the DevCon ListClass operation to list the devices in the DiskDrive, CDROM, and TapeDrive classes.

devcon listclass diskdrive cdrom tapedrive

Sebagai respons, DevCon menampilkan perangkat di kelas tersebut:

Listing 1 device(s) for setup class "DiskDrive" (Disk drives).
IDE\DISKWDC_WD204BA_____________________________16.13M16\4457572D414D3730323136333938203120202020: WDC WD204BA
Listing 1 device(s) for setup class "CDROM" (DVD/CD-ROM drives).
IDE\CDROMSAMSUNG_DVD-ROM_SD-608__________________2.2_____\4&13B4AFD&0&0.0.0: SAMSUNG DVD-ROM SD-608
No devices for setup class "TapeDrive" (Tape drives).

Contoh 8: Mencantumkan semua file driver

The following command uses the DevCon DriverFiles operation to list the file names of drivers that devices on the system use. Perintah menggunakan karakter kartubebas (*) untuk mewakili semua perangkat pada sistem. Because the output is extensive, it uses the redirection character (>) to save the command output in the specified file, driverfiles.txt.

devcon driverfiles * > driverfiles.txt

Contoh 9: Mencantumkan file driver perangkat tertentu

The following command uses the DevCon DriverFiles operation to search for the device driver used by the mouse device on the local computer. Perintah mengidentifikasi perangkat oleh salah satu ID perangkat kerasnya, HID\Vid_045e&Pid_0039&Rev_0121. ID perangkat keras diapit dalam tanda kutip (" ") karena menyertakan simbol ampersand (&).

devcon driverfiles "HID\Vid_045e&Pid_0039&Rev_0121"

Sebagai respons, DevCon menampilkan dua driver perangkat yang mendukung perangkat mouse:

HID\VID_045E&PID_0039\6&DC36FDE&0&0000
    Name: Microsoft USB IntelliMouse Optical
    Driver installed from c:\windows\inf\msmouse.inf [HID_Mouse_Inst]. 2 file(s)
 used by driver:
        C:\WINDOWS\System32\DRIVERS\mouhid.sys
        C:\WINDOWS\System32\DRIVERS\mouclass.sys
1 matching device(s) found.

Contoh 10: Mencantumkan paket driver berdasarkan pola ID perangkat keras

The following command uses the DevCon DriverNodes command and an ID pattern to list the driver nodes of software-enumerated devices. Pola berguna untuk menemukan informasi tentang perangkat serupa yang mungkin tidak berada di kelas penyiapan yang sama.

The following command uses the ID pattern sw* to specify devices with hardware IDs or compatible IDs that begin with "sw" for software-enumerated devices.

devcon drivernodes sw*

Sebagai respons, DevCon menampilkan simpul driver perangkat yang dijumlahkan perangkat lunak pada sistem:

SW\{A7C7A5B0-5AF3-11D1-9CED-00A024BF0407}\{9B365890-165F-11D0-A195-0020AFD156E4}

 Name: Microsoft Kernel System Audio Device
DriverNode #0:
    Inf file is c:\windows\inf\wdmaudio.inf
    Inf section is WDM_SYSAUDIO
    Driver description is Microsoft Kernel System Audio Device
    Manufacturer name is Microsoft
    Provider name is Microsoft
    Driver date is 7/1/2001
    Driver version is 5.1.2535.0
    Driver node rank is 0
    Driver node flags are 00002244
        Inf is digitally signed
SW\{B7EAFDC0-A680-11D0-96D8-00AA0051E51D}\{9B365890-165F-11D0-A195-0020AFD156E4}

    Name: Microsoft Kernel Wave Audio Mixer
DriverNode #0:
    Inf file is c:\windows\inf\wdmaudio.inf
    Inf section is WDM_KMIXER
    Driver description is Microsoft Kernel Wave Audio Mixer
    Manufacturer name is Microsoft
    Provider name is Microsoft
    Driver date is 7/1/2001
    Driver version is 5.1.2535.0
    Driver node rank is 0
    Driver node flags are 00002244
        Inf is digitally signed
SW\{CD171DE3-69E5-11D2-B56D-0000F8754380}\{9B365890-165F-11D0-A195-0020AFD156E4}

    Name: Microsoft WINMM WDM Audio Compatibility Driver
DriverNode #0:
    Inf file is c:\windows\inf\wdmaudio.inf
    Inf section is WDM_WDMAUD
    Driver description is Microsoft WINMM WDM Audio Compatibility Driver
    Manufacturer name is Microsoft
    Provider name is Microsoft
    Driver date is 7/1/2001
    Driver version is 5.1.2535.0
    Driver node rank is 0
    Driver node flags are 00002244
        Inf is digitally signed
3 matching device(s) found.

Contoh 11: Mencantumkan paket driver berdasarkan pola ID instans perangkat

The following command uses the DevCon DriverNodes operation to list the driver packages of all devices with device instance IDs that begin with ROOT\MEDIA for devices in the Enum\Root\Media registry subkey. The command uses the at symbol (@) to indicate that the phrase is in the device instance ID.

devcon drivernodes @ROOT\MEDIA*

Sebagai respons, DevCon menampilkan simpul driver perangkat dengan ID instans perangkat yang dimulai dengan ROOT\MEDIA:

ROOT\MEDIA\MS_MMACM
    Name: Audio Codecs
DriverNode #0:
    Inf file is c:\windows\inf\wave.inf
    Inf section is MS_MMACM
    Driver description is Audio Codecs
    Manufacturer name is (Standard system devices)
    Provider name is Microsoft
    Driver date is 7/1/2001
    Driver version is 5.1.2535.0
    Driver node rank is 0
    Driver node flags are 00002240
        Inf is digitally signed
ROOT\MEDIA\MS_MMDRV
    Name: Legacy Audio Drivers
DriverNode #0:
    Inf file is c:\windows\inf\wave.inf
    Inf section is MS_MMDRV
    Driver description is Legacy Audio Drivers
    Manufacturer name is (Standard system devices)
    Provider name is Microsoft
    Driver date is 7/1/2001
    Driver version is 5.1.2535.0
    Driver node rank is 0
    Driver node flags are 00002240
        Inf is digitally signed
ROOT\MEDIA\MS_MMMCI
    Name: Media Control Devices
DriverNode #0:
    Inf file is c:\windows\inf\wave.inf
    Inf section is MS_MMMCI
    Driver description is Media Control Devices
    Manufacturer name is (Standard system devices)
    Provider name is Microsoft
    Driver date is 7/1/2001
    Driver version is 5.1.2535.0
    Driver node rank is 0
    Driver node flags are 00002240
        Inf is digitally signed
ROOT\MEDIA\MS_MMVCD
    Name: Legacy Video Capture Devices
DriverNode #0:
    Inf file is c:\windows\inf\wave.inf
    Inf section is MS_MMVCD
    Driver description is Legacy Video Capture Devices
    Manufacturer name is (Standard system devices)
    Provider name is Microsoft
    Driver date is 7/1/2001
    Driver version is 5.1.2535.0
    Driver node rank is 0
    Driver node flags are 00002240
        Inf is digitally signed
ROOT\MEDIA\MS_MMVID
    Name: Video Codecs
DriverNode #0:
    Inf file is c:\windows\inf\wave.inf
    Inf section is MS_MMVID
    Driver description is Video Codecs
    Manufacturer name is (Standard system devices)
    Provider name is Microsoft
    Driver date is 7/1/2001
    Driver version is 5.1.2535.0
    Driver node rank is 0
    Driver node flags are 00002240
        Inf is digitally signed
5 matching device(s) found.

Contoh 12: Mencantumkan sumber daya kelas perangkat

The following command uses the DevCon Resources operation to display the resources allocated to devices in the Hdc device setup class. Kelas ini mencakup pengontrol IDE. Sintaks mendahului nama hdc kelas dengan simbol sama dengan (=) untuk menunjukkan bahwa nilai yang ditentukan adalah kelas dan bukan ID.

devcon resources =hdc

Sebagai respons, DevCon mencantumkan sumber daya yang dialokasikan untuk pengontrol IDE di komputer lokal:

PCI\VEN_8086&DEV_244B&SUBSYS_00000000&REV_02\3&29E81982&0&F9
    Name: Intel(r) 82801BA Bus Master IDE Controller
    Device is currently using the following resources:
        IO  : ffa0-ffaf
PCIIDE\IDECHANNEL\4&37E53584&0&0
    Name: Primary IDE Channel
    Device is currently using the following resources:
        IO  : 01f0-01f7
        IO  : 03f6-03f6
        IRQ : 14
PCIIDE\IDECHANNEL\4&37E53584&0&1
    Name: Secondary IDE Channel
    Device is currently using the following resources:
        IO  : 0170-0177
        IO  : 0376-0376
        IRQ : 15
3 matching device(s) found.

Contoh 13: Mencantumkan sumber daya perangkat menurut ID

The following command uses the DevCon Resources operation to list the resources allocated to the system timer. Perintah menggunakan ID perangkat keras timer sistem, ACPI\PNP0100, untuk menentukan perangkat.

devcon resources *PNP0100

Sebagai respons, DevCon menampilkan sumber daya timer sistem:

ROOT\*PNP0100\PNPBIOS_8
    Name: System timer
    Device has the following resources reserved:
        IO  : 0040-005f
        IRQ : 0
1 matching device(s) found.

Perintah berikut menggunakan ID instans perangkat dari timer sistem dalam perintah DevCon resources . The command uses the at symbol (@) to indicate that the string is a device instance ID and not a hardware ID or compatible ID.

devcon resources "@ACPI\PNP0100\4&b4063f4&0"

Contoh 14: Menampilkan tumpukan driver untuk perangkat penyimpanan

The following command uses the DevCon Stack operation to search for devices in the Volume setup class and display the expected driver stack for those devices. Simbol sama dengan (=) mendahului string untuk menunjukkan bahwa nilainya adalah kelas dan bukan ID.

devcon stack =Volume

Sebagai respons, DevCon menampilkan tumpukan yang diharapkan untuk perangkat di kelas Volume. Data yang dikembalikan mencakup informasi berikut:

  • ID instans perangkat dan deskripsi setiap perangkat
  • GUID dan nama kelas penyiapan perangkat
  • Nama driver filter atas dan bawah
  • Layanan pengontrol (jika ada)
STORAGE\VOLUME\1&30A96598&0&SIGNATURE32323533OFFSET271167600LENGTH6E00D0C00
    Name: Generic volume
    Setup Class: {71A27CDD-812A-11D0-BEC7-08002BE2092F} Volume
    Class upper filters:
        VolSnap
    Controlling service:
        (none)
STORAGE\VOLUME\1&30A96598&0&SIGNATURE32323533OFFSET7E00LENGTH27115F800
    Name: Generic volume
    Setup Class: {71A27CDD-812A-11D0-BEC7-08002BE2092F} Volume
    Class upper filters:
        VolSnap
    Controlling service:
        (none)
2 matching device(s) found.

Contoh 15: Menemukan kelas penyiapan perangkat

The DevCon Stack operation returns the setup class of a device in addition to the upper and lower filter drivers. Perintah berikut menemukan kelas penyiapan antarmuka port printer dengan menemukan ID instans perangkatnya lalu menggunakan ID instans perangkat untuk menemukan kelas penyiapannya.

The following command uses the DevCon HwIDs operation to find the device instance ID of the printer port interface. Ini mencari pada frasa "LPT" dalam ID perangkat keras port printer:

devcon hwids *lpt*

Sebagai respons, DevCon mengembalikan ID instans perangkat (ditampilkan dalam teks tebal) dan ID perangkat keras antarmuka port printer:

LPTENUM\MICROSOFTRAWPORT\5&CA97D7E&0&LPT1
    Name: Printer Port Logical Interface
    Hardware ID's:
        LPTENUM\MicrosoftRawPort958A
        MicrosoftRawPort958A
1 matching device(s) found.

The next command uses the DevCon Stack operation to find the device setup class of the device represented by the device instance ID. The command uses the at symbol (@) to identify the ID as a device instance ID. ID diapit dalam tanda kutip (" ") karena menyertakan simbol ampersand (&).

devcon stack "@LPTENUM\MICROSOFTRAWPORT\5&CA97D7E&0&LPT1"

Sebagai respons, DevCon menampilkan tumpukan driver untuk antarmuka port printer, termasuk kelas . Tampilan mengungkapkan bahwa port printer berada di kelas Sistem:

LPTENUM\MICROSOFTRAWPORT\5&CA97D7E&0&LPT1
    Name: Printer Port Logical Interface
    Setup Class: {4D36E97D-E325-11CE-BFC1-08002BE10318} System
    Controlling service:
        (none)
1 matching device(s) found.

The following command uses the DevCon Stack operation to display the expected stack for miniport driver devices. Ini melakukan pencarian perangkat dalam kelas pengaturan Net yang memiliki "miniport" di ID perangkat keras atau ID kompatibelnya.

Perintah ini pertama-tama membatasi pencarian ke kelas penyiapan Net lalu menemukan string "miniport". Ini tidak menemukan perangkat selain item di kelas penyiapan Net.

devcon stack =net *miniport*

Sebagai respons, DevCon menampilkan tumpukan yang diharapkan untuk driver miniport:

ROOT\MS_L2TPMINIPORT\0000
    Name: WAN Miniport (L2TP)
    Setup Class: {4D36E972-E325-11CE-BFC1-08002BE10318} Net
    Controlling service:
        Rasl2tp
ROOT\MS_PPPOEMINIPORT\0000
    Name: WAN Miniport (PPPOE)
    Setup Class: {4D36E972-E325-11CE-BFC1-08002BE10318} Net
    Controlling service:
        RasPppoe
    Lower filters:
        NdisTapi
ROOT\MS_PPTPMINIPORT\0000
    Name: WAN Miniport (PPTP)
    Setup Class: {4D36E972-E325-11CE-BFC1-08002BE10318} Net
    Controlling service:
        PptpMiniport
    Lower filters:
        NdisTapi
ROOT\MS_PTIMINIPORT\0000
    Name: Direct Parallel
    Setup Class: {4D36E972-E325-11CE-BFC1-08002BE10318} Net
    Controlling service:
        Raspti
    Lower filters:
        PtiLink
4 matching device(s) found.

Contoh 17: Menampilkan status semua perangkat

The following command uses the DevCon Status operation to find the status of all devices on the local computer. It then saves the status in the status.txt file for logging or later review. Perintah menggunakan karakter kartubebas (*) untuk mewakili semua perangkat. It uses the redirection character (>) to save the command output in the specified file, status.txt.

devcon status * > status.txt

Contoh 18: Menampilkan status perangkat menurut ID instans perangkat

Cara yang paling dapat diandalkan untuk menemukan status perangkat tertentu adalah dengan menggunakan ID instans perangkat perangkat.

The following command uses the device instance ID of the I/O controller on the local computer in a DevCon Status command. Perintah ini mencakup ID instans perangkat perangkat, PCI\VEN_8086&DEV_1130&SUBSYS_00000000&REV_02\3&29E81982&0&00. The command uses the at symbol (@) to identify the string as a device instance ID. ID diapit dalam tanda kutip (" ") karena menyertakan simbol ampersand (&).

devcon status "@PCI\VEN_8086&DEV_1130&SUBSYS_00000000&REV_02\3&29E81982&0&00"

Sebagai respons, DevCon menampilkan status pengontrol I/O:

PCI\VEN_8086&DEV_1130&SUBSYS_00000000&REV_02\3&29E81982&0&00
    Name: Intel(R) 82815 Processor to I/O Controller - 1130
    Driver is running.
1 matching device(s) found.

The following command uses the DevCon Status operation to display the status of particular storage-related devices. Ini mencari perangkat berikut:

  • Disk drive, GenDisk
  • CD-ROM drive, GenCdRom
  • Disk drive floppy, FDC\GENERIC_FLOPPY_DRIVE
  • Volume STORAGE\Volume
  • Manajer disk logis, ROOT\DMIO
  • Manajer volume, ROOT\FTDISK
  • Pengontrol disket, ACPI\PNP0700

Dalam perintah, setiap ID dipisahkan dari yang lain menurut spasi. Perhatikan bahwa GenDisk dan GenCdRom merupakan ID yang kompatibel, sedangkan ID lainnya adalah ID perangkat keras.

devcon status GenDisk GenCdRom FDC\GENERIC_FLOPPY_DRIVE STORAGE\Volume ROOT\DMIO ROOT\FTDISK ACPI\PNP0700

Sebagai respons, DevCon menampilkan status setiap perangkat:

FDC\GENERIC_FLOPPY_DRIVE\1&3A2146F1&0&0
    Name: Floppy disk drive
    Driver is running.
IDE\CDROMSAMSUNG_DVD-ROM_SD-608__________________2.2_____\4&13B4AFD&0&0.0.0
    Name: SAMSUNG DVD-ROM SD-608
    Driver is running.
IDE\DISKWDC_WD204BA_____________________________16.13M16\4457572D414D373032313633393820312
0202020
    Name: WDC WD204BA
    Driver is running.
ROOT\DMIO\0000
    Name: Logical Disk Manager
    Driver is running.
ROOT\FLOPPYDISK\0000
    Device has a problem: 28.
ROOT\FLOPPYDISK\0002
    Device has a problem: 01.
ROOT\FLOPPYDISK\0003
    Device has a problem: 01.
ROOT\FLOPPYDISK\0004
    Device is currently stopped.
ROOT\FTDISK\0000
    Name: Volume Manager
    Driver is running.
STORAGE\VOLUME\1&30A96598&0&SIGNATUREEA1AA9C7OFFSET1770DF800LENGTH3494AEA00
    Name: Generic volume
    Driver is running.
STORAGE\VOLUME\1&30A96598&0&SIGNATUREEA1AA9C7OFFSET7E00LENGTH1770CFC00
    Name: Generic volume
    Driver is running.
11 matching device(s) found.

Contoh 20: Menemukan perangkat berdasarkan pola ID perangkat keras

The following command uses the DevCon Find operation to search for mouse devices. Secara khusus, perintah mencari komputer untuk perangkat dengan ID perangkat keras atau ID yang kompatibel yang menyertakan frasa "mou":

devcon find *mou*

Sebagai respons, DevCon menemukan dua perangkat mouse:

ROOT\*PNP0F03\1_0_21_0_31_0                                 : Microsoft PS/2 Mouse
ROOT\RDP_MOU\0000                                           : Terminal Server Mouse Driver

Karena semua operasi tampilan DevCon juga menemukan ID perangkat keras, Anda dapat menggunakan operasi tampilan apa pun untuk mencari ID perangkat keras. Pilih operasi berdasarkan konten yang Anda butuhkan dalam output. Misalnya, untuk menemukan driver perangkat untuk perangkat terkait mouse di komputer lokal, kirimkan perintah berikut:

devcon driverfiles *mou*

Sebagai respons, DevCon menemukan perangkat dan mencantumkan driver mereka:

HID\VID_045E&PID_0039\6&DC36FDE&0&0000
    Name: Microsoft USB IntelliMouse Optical
    Driver installed from c:\windows\inf\msmouse.inf [HID_Mouse_Inst]. 2 file(s) used by d
river:
        C:\WINDOWS\System32\DRIVERS\mouhid.sys
        C:\WINDOWS\System32\DRIVERS\mouclass.sys
ROOT\RDP_MOU\0000
    Name: Terminal Server Mouse Driver
    Driver installed from c:\windows\inf\machine.inf [RDP_MOU]. 2 file(s) used by driver:
        C:\WINDOWS\System32\DRIVERS\termdd.sys
        C:\WINDOWS\System32\DRIVERS\mouclass.sys
2 matching device(s) found.

Contoh 21: Menemukan perangkat berdasarkan ID instans perangkat atau kelas

The following commands use the DevCon Find operation to display all legacy devices on the local computer. Karena perangkat warisan tidak memiliki ID perangkat keras, Anda harus mencarinya dengan ID instans perangkat mereka (jalur registri), ROOT\LEGACY, atau kelas penyiapannya, LegacyDriver.

Perintah pertama menemukan driver legacy berdasarkan pola ID instansi perangkat. The at symbol (@) precedes the ID pattern to indicate that the value is a device instance ID. The value is followed by the wildcard character (*) to instruct the command to find all devices in the specified ID, the ROOT\Legacy subkey:

devcon find @root\legacy*

Perintah kedua menemukan perangkat warisan dengan mencari semua perangkat di kelas LegacyDriver:

devcon find =legacydriver

Kedua perintah menghasilkan output yang sama, dalam hal ini, menemukan 27 perangkat warisan yang sama:

ROOT\LEGACY_AFD\0000                                        : AFD Networking Support Environment
ROOT\LEGACY_BEEP\0000                                       : Beep
ROOT\LEGACY_DMBOOT\0000                                     : dmboot
ROOT\LEGACY_DMLOAD\0000                                     : dmload
ROOT\LEGACY_FIPS\0000                                       : Fips
ROOT\LEGACY_GPC\0000                                        : Generic Packet Classifier
ROOT\LEGACY_IPSEC\0000                                      : ipsec
ROOT\LEGACY_KSECDD\0000                                     : ksecdd
ROOT\LEGACY_MNMDD\0000                                      : mnmdd
ROOT\LEGACY_MOUNTMGR\0000                                   : mountmgr
ROOT\LEGACY_NDIS\0000                                       : ndis
ROOT\LEGACY_NDISTAPI\0000                                   : Remote Access NDIS TAPI Driver
ROOT\LEGACY_NDISUIO\0000                                    : NDIS Usermode I/O Protocol
ROOT\LEGACY_NDPROXY\0000                                    : NDProxy
ROOT\LEGACY_NETBT\0000                                      : netbt
ROOT\LEGACY_NULL\0000                                       : Null
ROOT\LEGACY_PARTMGR\0000                                    : PartMgr
ROOT\LEGACY_PARVDM\0000                                     : ParVdm
ROOT\LEGACY_RASACD\0000                                     : Remote Access Auto Connection Driver
ROOT\LEGACY_RDPCDD\0000                                     : RDPCDD
ROOT\LEGACY_RDPWD\0000                                      : RDPWD
ROOT\LEGACY_TCPIP\0000                                      : tcpip
ROOT\LEGACY_TDPIPE\0000                                     : TDPIPE
ROOT\LEGACY_TDTCP\0000                                      : TDTCP
ROOT\LEGACY_VGASAVE\0000                                    : VgaSave
ROOT\LEGACY_VOLSNAP\0000                                    : VolSnap
ROOT\LEGACY_WANARP\0000                                     : Remote Access IP ARP Driver
27 matching device(s) found.

Contoh 22: Temukan (dan temukan semua) perangkat di kelas pengaturan

The following command uses the DevCon FindAll operation to find all devices on the computer in the Net setup class. Simbol sama dengan (=) mendahului nama kelas "Net" untuk menunjukkan bahwa nilai yang ditentukan adalah kelas dan bukan ID.

devcon findall =net

Sebagai respons, DevCon mencantumkan tujuh perangkat berikut di kelas penyiapan Net. Enam pertama adalah perangkat driver miniport standar. Perangkat ketujuh, adaptor asinkron RAS, adalah perangkat yang dijumlahkan perangkat lunak (SW\*) yang diinstal hanya sesuai kebutuhan.

PCI\VEN_10B7&DEV_9200&SUBSYS_00BE1028&REV_78\4&BB7B4AE&0&60F0: 3Com 3C920 Integrated Fast
Ethernet Controller (3C905C-TX Compatible)
ROOT\MS_L2TPMINIPORT\0000                                   : WAN Miniport (L2TP)
ROOT\MS_NDISWANIP\0000                                      : WAN Miniport (IP)
ROOT\MS_PPPOEMINIPORT\0000                                  : WAN Miniport (PPPOE)
ROOT\MS_PPTPMINIPORT\0000                                   : WAN Miniport (PPTP)
ROOT\MS_PTIMINIPORT\0000                                    : Direct Parallel
SW\{EEAB7790-C514-11D1-B42B-00805FC1270E}\ASYNCMAC          : RAS Async Adapter
7 matching device(s) found.

The following command compares the output from the DevCon Find and DevCon FindAll operations by running a DevCon Find command with the same parameters as the previous DevCon FindAll command:

devcon find =net

Sebagai respons, DevCon mencantumkan enam perangkat berikut di kelas penyiapan Net:

PCI\VEN_10B7&DEV_9200&SUBSYS_00BE1028&REV_78\4&BB7B4AE&0&60F0: 3Com 3C920 Integrated Fast
Ethernet Controller (3C905C-TX Compatible)
ROOT\MS_L2TPMINIPORT\0000                                   : WAN Miniport (L2TP)
ROOT\MS_NDISWANIP\0000                                      : WAN Miniport (IP)
ROOT\MS_PPPOEMINIPORT\0000                                  : WAN Miniport (PPPOE)
ROOT\MS_PPTPMINIPORT\0000                                   : WAN Miniport (PPTP)
ROOT\MS_PTIMINIPORT\0000                                    : Direct Parallel
6 matching device(s) found.

Predictably, the DevCon Find command, which returns only currently installed devices, doesn't list the software-enumerated device because the device isn't installed.

Contoh 23: Menampilkan driver filter untuk kelas pengaturan

The following command uses the DevCon ClassFilter operation to display the upper filter drivers for the DiskDrive setup class. Karena perintah ini tidak mencakup operator classfilter, DevCon menampilkan driver filter untuk kelas, tetapi tidak mengubahnya.

devcon classfilter DiskDrive upper

Sebagai respons, DevCon menampilkan driver filter atas untuk kelas DiskDrive dan mengonfirmasi driver filter tidak diubah. In this case, the display shows that devices in the DiskDrive setup class use the PartMgr.sys upper filter driver:

Class filters unchanged.
    PartMgr

Contoh 24: Menambahkan driver penyaring ke kelas pengaturan

The following command uses the DevCon ClassFilter operation to add a fictitious filter, Disklog.sys, to the list of upper filter drivers for the DiskDrive setup class.

This command uses the add-after (+, the plus symbol) ClassFilter operator to load the Disklog driver after the PartMgr driver so it receives data that PartMgr.sys already processed.

Saat perintah dimulai, kursor virtual diposisikan sebelum driver filter pertama. Karena tidak diposisikan pada driver tertentu, DevCon menambahkan driver Disklog ke akhir daftar driver filter.

Perintah ini juga menggunakan /r parameter , yang me-reboot sistem seperlunya untuk membuat perubahan filter kelas efektif.

devcon /r classfilter DiskDrive upper +Disklog

Sebagai respons, DevCon menampilkan driver filter atas saat ini untuk kelas DiskDrive:

Class filters changed. Class devices must be restarted for changes to take effect.
    PartMgr
    Disklog

Jika Anda salah mengeja nama driver, atau mencoba menambahkan driver yang tidak diinstal pada sistem, perintah gagal. DevCon tidak menambahkan driver kecuali driver terdaftar sebagai layanan. That is, DevCon only adds the driver if it has a subkey in the Services registry HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services subkey.

Perintah berikut menguji fitur perlindungan ini. Ini mencoba menambahkan "Disklgg" (bukan "Disklog") ke daftar filter atas untuk kelas DiskDrive. Output menunjukkan bahwa perintah gagal:

devcon /r classfilter DiskDrive upper +Disklgg
devcon failed.

Contoh 25: Menyisipkan driver filter dalam daftar kelas

The following command uses the DevCon ClassFilter operation to add a fictitious filter driver, MyFilter.sys, to the list of upper filter drivers for the DiskDrive setup class. The command places MyFilter.sys between PartMgr.sys and Disklog.sys in the load order:

devcon /r classfilter DiskDrive upper @Disklog -MyFilter

Daftar berikut ini memperlihatkan driver filter untuk kelas DiskDrive sebelum perintah dikirimkan:

    PartMgr
    Disklog

The first subcommand, @Disklog, uses the positioning operator (@, the at symbol) to place the virtual cursor on the Disklog filter driver. The second subcommand, -MyFilter, uses the add-before operator (-, the minus symbol) to add MyFilter.sys before Disklog.sys.

Perintah ini juga menggunakan /r parameter , yang me-reboot sistem seperlunya untuk membuat perubahan filter kelas efektif.

Operator pengaturan posisi sangat penting dalam contoh ini. Sebelum DevCon memproses sub-perintah classfilter apa pun, kursor virtual berada di awal daftar dan tidak diposisikan pada driver filter apa pun. Jika Anda menggunakan operator add-before (+) saat kursor tidak diposisikan pada driver, DevCon menambahkan driver ke awal daftar. Jika Anda menggunakan operator add-after (-) saat kursor tidak diposisikan pada driver, itu menambahkan driver ke akhir daftar.

Sebagai respons, DevCon menampilkan driver filter atas saat ini untuk kelas DiskDrive:

Class filters changed. Class devices must be restarted for changes to take effect.
    PartMgr
    MyFilter
    Disklog

Anda juga dapat menggunakan perintah berikut untuk menambahkan driver MyFilter dan menempatkannya antara PartMgr dan Disklog. Dalam contoh ini, sub perintah pertama, @PartMgr, memosisikan kursor virtual pada driver filter PartMgr. The second subcommand, +MyFilter, uses the add-after operator (+) to add MyFilter.sys after PartMgr:

devcon /r classfilter DiskDrive upper @PartMgr +MyFilter

Contoh 26: Mengganti driver filter

The following command uses the DevCon ClassFilter operation to replace the original copy of MyFilter.sys with a new and improved version, MyNewFilter.sys, in the list of filter drivers for the DiskDrive setup class:

devcon /r classfilter DiskDrive upper !MyFilter +MyNewFilter

Daftar berikut ini memperlihatkan driver filter untuk kelas DiskDrive sebelum perintah dikirimkan:

    PartMgr
    MyFilter
    Disklog

Sub perintah pertama menggunakan operator penghapusan (!, tanda seru) untuk menghapus MyFilter dari daftar driver filter atas untuk kelas DiskDrive. (It doesn't affect the MyFilter.sys file in the C:\Windows\System32\Drivers directory location.)

Sub-perintah kedua menggunakan operator add-after (+) untuk menempatkan driver filter baru di posisi yang sebelumnya ditempati oleh driver yang dihapus. Karena operator hapus meninggalkan kursor di posisi yang ditempati filter yang dihapus, operator add-before (-) dan add-after (+) memiliki efek yang sama.

Perintah ini juga menggunakan /r parameter , yang me-reboot sistem seperlunya untuk membuat perubahan filter kelas efektif.

Sebagai respons, DevCon memperlihatkan konfigurasi filter kelas baru untuk kelas DiskDrive:

Class filters changed. Class devices must be restarted for changes to take effect.
    PartMgr
    MyNewFilter
    Disklog

Contoh 27: Mengubah urutan driver filter

The following command uses the DevCon ClassFilter operation to change the order of filter drivers for the DiskDrive setup class. Secara khusus, ini membalikkan urutan driver filter kedua dan ketiga.

devcon /r classfilter DiskDrive upper !Disklog =@PartMgr +Disklog

Daftar berikut ini memperlihatkan driver filter untuk kelas DiskDrive sebelum perintah dikirimkan. Ini juga menunjukkan tujuan hasil dari perintah tersebut.

Before After
PartMgr PartMgr
MyNewFilter Disklog
Disklog MyNewFilter

Sub perintah pertama menggunakan operator penghapusan (!) untuk menghapus Disklog dari daftar. The second subcommand uses the start operator (=, the equals symbol) to move the virtual cursor back to the starting position and the positioning operator (@, the at symbol) to place the cursor on the PartMgr driver. Operator mulai diperlukan karena kursor virtual hanya bergerak maju melalui daftar. Sub-perintah akhir menggunakan operator add-after (+) untuk menambahkan Disklog setelah PartMgr.

Sebagai respons, DevCon memperlihatkan konfigurasi filter kelas baru untuk kelas DiskDrive:

Class filters changed. Class devices must be restarted for changes to take effect.
    PartMgr
    Disklog
    MyNewFilter

Contoh 28: Mengaktifkan perangkat tertentu

The following command uses the DevCon Enable operation to enable a previously disabled programmable interrupt controller. Terkontrol dinonaktifkan lalu diaktifkan kembali untuk memperbaiki masalah sistem. Karena ID perangkat keras pengontrol dalam contoh ini menyertakan tanda bintang (*PNP0000), perintah menggunakan karakter tanda kutip tunggal (') untuk mengarahkan DevCon untuk menemukan ID perangkat keras tepat seperti yang ditentukan dalam perintah. Jika perintah tidak menggunakan karakter kutipan (') dalam instans ini, DevCon menginterpretasikan tanda bintang (*) dalam nilai sebagai karakter kartubebas.

devcon enable '*PNP0000

Sebagai respons, DevCon menampilkan ID instans perangkat perangkat dan menjelaskan bahwa Anda harus me-reboot sistem untuk mengaktifkan perangkat:

ACPI\PNP0000\4&B4063F4&0                                    : Enabled on reboot
Not all of 1 device(s) enabled, at least one requires reboot to complete the operation.

You can respond by rebooting the system manually, or by using the DevCon Reboot operation.

Perintah berikut menambahkan /r parameter ke perintah sebelumnya. Parameter /r me-reboot sistem seperlunya untuk menyelesaikan operasi.

devcon /r enable '*PNP0000

Sebagai respons, DevCon memungkinkan perangkat dan kemudian me-reboot sistem untuk membuat operasi pengaktifan efektif.

Saat sistem dimulai, gunakan perintah DevCon status untuk mengonfirmasi bahwa perangkat diaktifkan:

devcon status '*PNP0000

ACPI\PNP0000\4&B4063F4&0
    Name: Programmable interrupt controller
    Driver is running.

Contoh 29: Mengaktifkan perangkat menurut kelas

The following command enables all printer devices on the computer by specifying the Printer setup class in a DevCon Enable command. Perintah ini mencakup /r parameter , yang me-reboot sistem seperlunya untuk membuat operasi pengaktifan efektif.

devcon /r enable =Printer

Sebagai respons, DevCon menampilkan ID instans perangkat printer yang ditemukan di kelas Printer dan melaporkan bahwa printer diaktifkan. Meskipun perintah menyertakan /r parameter, sistem tidak melakukan boot ulang karena reboot tidak diperlukan untuk mengaktifkan printer.

LPTENUM\HEWLETT-PACKARDDESKJET_1120C\1&7530F08&0&LPT1.4        : Enabled
1 device(s) enabled.

Contoh 30: Menonaktifkan perangkat dengan pola ID

The following command uses the DevCon Disable operation to disable the USB devices on the local computer. Ini mengidentifikasi perangkat dengan pola ID perangkat keras (USB*). Pola ini cocok dengan perangkat apa pun dengan ID perangkat keras atau ID yang kompatibel yang dimulai dengan "USB." Perintah ini mencakup /r parameter , yang me-reboot sistem seperlunya untuk membuat operasi penonaktifan efektif.

Note

Sebelum Anda menggunakan pola ID untuk menonaktifkan perangkat, tentukan perangkat mana yang mungkin terpengaruh. Gunakan pola dalam perintah tampilan, seperti devcon status USB* atau devcon hwids USB*.

devcon /r disable USB*

Sebagai respons, DevCon menampilkan ID instans perangkat dari perangkat USB dan melaporkan bahwa ID dinonaktifkan. Meskipun perintah menyertakan /r parameter , sistem tidak di-boot ulang karena reboot tidak diperlukan untuk menonaktifkan perangkat.

USB\ROOT_HUB\4&2A40B465&0
: Disabled
USB\ROOT_HUB\4&7EFA360&0
: Disabled
USB\VID_045E&PID_0039\5&29F428A4&0&2
: Disabled
3 device(s) disabled.

Contoh 31: Menonaktifkan perangkat berdasarkan ID instans perangkat

The following command uses the DevCon Disable operation to disable the USB devices on the local computer. The command uses the at symbol (@) to identify the devices by their device instance IDs. Setiap ID instans perangkat dipisahkan dari yang lain dengan spasi.

Ketika ID perangkat menyertakan simbol ampersand (&), nilai diapit dalam tanda kutip (" "). Perintah ini mencakup /r parameter , yang me-reboot sistem seperlunya untuk membuat operasi penonaktifan efektif.

devcon /r disable "@USB\ROOT_HUB\4&2A40B465&0" "@USB\ROOT_HUB\4&7EFA360&0" "@USB\VID_045E&PID_0039\5&29F428A4&0&2"

Sebagai respons, DevCon menampilkan ID instans perangkat dari perangkat USB dan melaporkan bahwa ID dinonaktifkan. Meskipun perintah menyertakan /r parameter , sistem tidak di-boot ulang karena reboot tidak diperlukan untuk menonaktifkan perangkat.

USB\ROOT_HUB\4&2A40B465&0
: Disabled
USB\ROOT_HUB\4&7EFA360&0
: Disabled
USB\VID_045E&PID_0039\5&29F428A4&0&2
: Disabled
3 device(s) disabled.

Contoh 32: Memperbarui driver untuk port komunikasi

The following command uses the DevCon Update operation to replace the current device driver for communication ports on the system with a test driver specified in the test.inf file. Perintah hanya memengaruhi perangkat yang seluruh ID perangkat kerasnya *PNP0501 (termasuk tanda bintang *).

Anda dapat menggunakan perintah ini untuk mengganti driver yang ditandatangani pada sistem dengan driver alternatif untuk pengujian atau pemecahan masalah, atau untuk mengaitkan perangkat dengan versi terbaru dari driver yang sama.

devcon update c:\windows\inf\test.inf *PNP0501

In response, DevCon displays a Hardware Installation warning explaining that the driver didn't pass Windows Logo testing. If you select the Continue Anyway option on the dialog, the installation continues.

Kemudian, DevCon menampilkan pesan keberhasilan berikut:

Updating drivers for *PNP0501 from c:\windows\inf\test.inf.
Drivers updated successfully.

You can also use the DevCon UpdateNI operation, the noninteractive version of the DevCon Update operation, to update drivers. The DevCon UpdateNI operation is identical to the DevCon Update operation except it suppresses all user prompts that require a response and assumes the default response to the prompt.

The following command uses the DevCon UpdateNI operation to install the test driver:

devcon updateni c:\windows\inf\test.inf *PNP0501

In this case, DevCon doesn't display the Hardware Installation warning. Instead, it assumes the default response, Stop Installation. Akibatnya, DevCon tidak dapat memperbarui driver dan menampilkan pesan kegagalan:

Updating drivers for *PNP0501 from c:\windows\inf\test.inf.
devcon failed.

Contoh 33: Menginstal perangkat

The following command uses the DevCon Install operation to install a keyboard device on the local computer. The command includes the full path to the setup information (INF) file keyboard.inf for the device and a hardware ID *PNP030b:

devcon /r install c:\windows\inf\keyboard.inf *PNP030b

Sebagai respons, DevCon melaporkannya menginstal perangkat. Artinya, DevCon membuat simpul perangkat untuk perangkat baru dan memperbarui file driver untuk perangkat.

Device node created. Install is complete when drivers files are updated...
Updating drivers for *PNPO30b from c:\windows\inf\keyboard.inf
Drivers updated successfully.

Contoh 34: Menginstal perangkat dengan menggunakan penyiapan tanpa pengawas

Contoh berikut menunjukkan cara menginstal Microsoft Loopback Adapter selama penginstalan Microsoft Windows XP tanpa pengawas.

To install this device during an unattended setup, begin by adding the following files to a floppy disk: devcon.exe and netloop.inf (C:\Windows\inf\netloop.inf).

Kemudian tambahkan perintah DevCon berikut di bagian [GUIRunOnce] file penyiapan tanpa pengawas:

a:\devcon /r install a:\Netloop.inf '*MSLOOP

Perintah ini mengidentifikasi adaptor loopback dengan menggunakan ID perangkat kerasnya, *MSLOOP. Karakter kutipan tunggal (') yang mendahului nilai \*MSLOOP menginformasikan DevCon untuk menginterpretasikan string secara harfiah. Akibatnya, DevCon menginterpretasikan tanda bintang (*) sebagai bagian dari ID perangkat keras dan bukan sebagai karakter kartubebas.

The command also specifies that DevCon use the Netloop.inf file (on the floppy disk) in the installation. Parameter /r me-reboot komputer seperlunya untuk menyelesaikan penginstalan.

Terakhir, tambahkan pengaturan konfigurasi jaringan ke file penyiapan tanpa pengawas dan jalankan penyiapan tanpa pengawas.

Contoh 35: Menghapus perangkat berdasarkan pola ID instans perangkat

The following command uses the DevCon Remove operation to remove all USB devices from the computer. Ini mengidentifikasi perangkat dengan pola ID instans perangkat yang cocok dengan ID instans perangkat apa pun (jalur registri) yang dimulai dengan string "USB". The command uses the at symbol (@) to distinguish the device instance ID from a hardware ID or compatible ID. Perintah ini juga mencakup /r parameter yang me-reboot sistem seperlunya untuk membuat penghapusan efektif.

Warning

Sebelum Anda menggunakan pola ID untuk menghapus perangkat, tentukan perangkat mana yang mungkin terpengaruh. Gunakan pola dalam perintah tampilan, seperti devcon status @usb\* atau devcon hwids @usb\*.

devcon /r remove @usb\*

Sebagai respons, DevCon menampilkan ID instans perangkat dari perangkat yang dihapus:

USB\ROOT_HUB\4&2A40B465&0                             : Removed
USB\ROOT_HUB\4&7EFA360&0                              : Removed
USB\VID_045E&PID_0039\5&29F428A4&0&2                  : Removed
3 device(s) removed.

Contoh 36: Menghapus perangkat jaringan tertentu

The following command uses the DevCon Remove operation to uninstall the NDISWAN miniport driver from the local computer. Perintah menentukan kelas Net lalu menyempurnakan pencarian dengan menentukan perangkat di kelas yang ID perangkat kerasnya atau ID yang kompatibel termasuk "ndiswan." Perintah ini juga mencakup /r parameter , yang me-reboot sistem seperlunya untuk membuat penghapusan efektif.

Warning

Sebelum Anda menggunakan pola ID untuk menghapus perangkat, tentukan perangkat mana yang mungkin terpengaruh. Gunakan pola dalam perintah tampilan, seperti devcon status =net *ndiswan atau devcon hwids =net *ndiswan*.

devcon /r remove =net *ndiswan*

Sebagai respons, DevCon menampilkan ID instans perangkat dari perangkat yang dihapus:

ROOT\MS_NDISWANIP\0000 : Removed 1 device(s) removed.

Contoh 37: Memindai komputer untuk perangkat baru

The following command uses the DevCon Rescan operation to scan the local computer for new devices.

devcon rescan

Sebagai respons, DevCon melaporkan bahwa devCon memindai sistem tetapi tidak menemukan perangkat baru:

Scanning for new hardware.
Scanning completed.

Contoh 38: Memulai ulang perangkat

The following command uses the DevCon Restart operation to restart the loopback adapter on the local computer. Perintah membatasi pencarian ke kelas penyiapan Net dan, dalam kelas tersebut, menentukan ID instans perangkat adaptor loopback, @'ROOT\*MSLOOP\0000.

The at symbol (@) identifies the string value as a device instance ID. Karakter kutipan tunggal (') menginformasikan DevCon untuk menginterpretasikan string secara harfiah. Akibatnya, DevCon menginterpretasikan tanda bintang (*) sebagai bagian dari ID dan bukan sebagai karakter kartubebas.

devcon restart =net @'ROOT\*MSLOOP\0000

Sebagai respons, DevCon menampilkan ID instans perangkat perangkat dan melaporkan hasilnya:

ROOT\*MSLOOP\0000                                              : Restarted
1 device(s) restarted.

Contoh 39: Reboot komputer lokal

The following command uses the DevCon Reboot operation to reboot the operating system on the local computer and to associate the reboot with a hardware installation. Unlike the /r parameter, the DevCon Reboot operation doesn't depend on the return code from another operation.

Anda dapat menyertakan perintah ini dalam skrip dan file batch yang mengharuskan sistem untuk memulai ulang.

devcon reboot

Sebagai respons, DevCon menampilkan pesan yang menunjukkan bahwa komputer dimulai ulang (Me-reboot komputer lokal).

DevCon uses the standard ExitWindowsEx function to reboot. Jika pengguna membuka file di komputer atau program tidak ditutup, sistem tidak memulai ulang. Ini menunggu sampai pengguna merespons permintaan sistem untuk menutup file atau mengakhiri proses.

Contoh 40: Menetapkan ID perangkat keras ke perangkat warisan

The following command uses the DevCon SetHwID operation to assign the hardware ID beep to the legacy beep device.

Perintah menggunakan ID instans perangkat perangkat ROOT\LEGACY_BEEP\0000 karena perangkat warisan bip tidak memiliki ID perangkat keras atau ID yang kompatibel. The command uses the at symbol (@) to indicate that the string is a device instance ID.

Perintah tidak menggunakan parameter simbol apa pun untuk memposisikan ID. Secara default, DevCon menambahkan ID perangkat keras baru ke akhir daftar ID perangkat keras. Dalam hal ini, karena perangkat tidak memiliki ID perangkat keras lain, penempatan ID tidak relevan.

devcon sethwid @ROOT\LEGACY_BEEP\0000 := beep

Sebagai respons, DevCon menampilkan pesan yang menunjukkan bahwa pesan ditambahkan beep ke daftar ID perangkat keras untuk perangkat. Ini juga menampilkan daftar ID perangkat keras yang dihasilkan. Dalam hal ini, hanya satu ID perangkat keras yang ada dalam daftar:

ROOT\LEGACY_BEEP\0000                              : beep
Modified 1 hardware ID(s).

Contoh 41: Menambahkan ID perangkat keras ke semua perangkat warisan

The following command uses the DevCon SetHwID operation to add the hardware ID, legacy, to the list of hardware IDs for all legacy devices.

Perintah menggunakan parameter simbol minus (-) untuk menambahkan ID perangkat keras baru ke akhir daftar ID perangkat keras untuk perangkat, jika ADA ID perangkat keras pilihan untuk salah satu perangkat. Ini juga menggunakan pola ID instans perangkat, @ROOT\LEGACY*, untuk mengidentifikasi perangkat warisan di komputer, yaitu semua perangkat yang memiliki ID instans perangkat yang dimulai dengan ROOT\LEGACY*.

devcon sethwid @ROOT\LEGACY* := -legacy

Sebagai respons, DevCon menampilkan daftar ID perangkat keras yang dihasilkan untuk semua perangkat yang terpengaruh:

ROOT\LEGACY_AFD\0000                                        : legacy
ROOT\LEGACY_BEEP\0000                                    : beep,legacy
ROOT\LEGACY_CRCDISK\0000                                    : legacy
ROOT\LEGACY_DMBOOT\0000                                     : legacy
ROOT\LEGACY_DMLOAD\0000                                     : legacy
ROOT\LEGACY_FIPS\0000                                       : legacy
...
ROOT\LEGACY_WANARP\0000                                     : legacy
Modified 27 hardware ID(s).

Setelah menetapkan ID perangkat keras yang sama ke sekelompok perangkat, Anda dapat menggunakan operasi DevCon lainnya untuk melihat dan mengubah perangkat dalam satu perintah.

Misalnya, perintah berikut menampilkan status semua perangkat warisan:

devcon status legacy

Contoh 42: Menghapus ID perangkat keras dari semua perangkat warisan

The following command uses the DevCon SetHwID operation to delete the hardware ID legacy from the list of hardware IDs for all legacy devices.

Perintah menggunakan ID legacy perangkat keras untuk mengidentifikasi semua perangkat yang memiliki ID perangkat keras tersebut. Ini menggunakan operator penghapusan (!) untuk menghapus legacy ID perangkat keras.

devcon sethwid legacy := !legacy

Sebagai respons, DevCon menampilkan daftar ID perangkat keras yang dihasilkan untuk semua perangkat yang terpengaruh:

ROOT\LEGACY_AFD\0000                                        :
ROOT\LEGACY_BEEP\0000                                    : beep
ROOT\LEGACY_CRCDISK\0000                                    :
ROOT\LEGACY_DMBOOT\0000                                     :
ROOT\LEGACY_DMLOAD\0000                                     :
ROOT\LEGACY_FIPS\0000                                       :
...
ROOT\LEGACY_WANARP\0000                                     :
Modified 27 hardware ID(s).

Contoh 43: Menambahkan, menghapus, dan mengganti ID perangkat keras

The following examples show how to use the various features of the DevCon SetHwID operation.

This series of examples uses a fictitious device, DeviceX, with the device instance ID, ROOT\DeviceX\0000. Sebelum perintah DevCon berjalan untuk perangkat, perangkat memiliki daftar ID perangkat keras berikut:

Hw3 Hw4

Perintah berikut menggunakan simbol plus (+) untuk menambahkan nilai Hw1 ID dan Hw2 ke awal daftar ID perangkat keras untuk DeviceX. Hw2 Karena ID sudah muncul dalam daftar, nilai ID dipindahkan, tidak ditambahkan. The command uses the at symbol (@) to identify the device by its device instance ID.

devcon sethwid @ROOT\DEVICEX\0000 := +Hw1 Hw2

Sebagai respons, DevCon menampilkan daftar ID perangkat keras baru untuk perangkat. Nilai Hw1 ID dan Hw2 muncul di awal daftar ID dalam urutan yang ditentukan:

ROOT\DEVICEX\0000                         : Hw1,Hw2,Hw3,Hw4
Modified 1 hardware ID(s).

Selain itu, DevCon melaporkan bahwa ia memodifikasi satu daftar ID perangkat keras, yaitu, daftar ID perangkat keras dari satu perangkat.

Perintah berikut menggunakan operator hapus (!) untuk menghapus Hw1 ID perangkat keras. Kemudian mencantumkan ID Hw5 perangkat keras tanpa parameter simbol. Without symbol parameters, SetHwID adds the hardware ID to the end of the hardware ID list for the device.

This command demonstrates that unlike the other symbol parameters for the DevCon SetHwID operation, the delete operator (!) applies only to the hardware ID that it prefixes.

devcon sethwid @ROOT\DeviceX\0000 := !Hw1 Hw5

Sebagai respons, DevCon menampilkan daftar ID perangkat keras yang dihasilkan untuk DeviceX:

ROOT\DEVICEX\0000                         : Hw2,Hw3,Hw4,Hw5
Modified 1 hardware ID(s).

Perintah berikut menggunakan parameter sama dengan (=) untuk mengganti semua ID perangkat keras dalam daftar untuk DeviceX dengan SATU ID perangkat keras, DevX.

devcon sethwid @ROOT\DeviceX\0000 := =DevX

Sebagai respons, DevCon menampilkan daftar ID perangkat keras yang dihasilkan untuk DeviceX:

ROOT\DEVICEX\0000                         : DevX
Modified 1 hardware ID(s).

Pesan keberhasilan menunjukkan bahwa DevCon memodifikasi ID perangkat keras dari satu perangkat.

Contoh 44: Memperbarui HAL secara paksa

Contoh berikut menunjukkan cara menggunakan DevCon untuk memperbarui HAL di komputer. HAL saat ini adalah uniprocessor (_up) yang dibangun dengan Konfigurasi Tingkat Lanjut dan Antarmuka Daya (ACPI) dan Advanced Programmable Interrupt Controller (APIC), yang sesuai untuk komputer. Penguji ingin mengubah jenis menjadi multiprocessor (_mp) ACPI APIC HAL untuk tujuan pengujian.

The first command uses the DevCon SetHwID operation to change the hardware ID of the HAL from acpiapic_up, the hardware ID for uniprocessor HALs, to acpiapic_mp, the hardware ID for multiprocessor HALs.

You must change the hardware ID because the INF file (.inf) for the HAL includes drivers for both uniprocessor and multiprocessor HALs. The system selects the most appropriate driver from the INF file (.inf) based on the hardware ID of the device. If you don't change the hardware ID, the DevCon Update command reinstalls the same uniprocessor HAL driver.

In the following example, the command identifies the HAL by its instance ID, ROOT\ACPI_HAL\0000, as indicated by the at symbol (@) preceding the ID. Perintah menggunakan simbol plus (+) untuk menentukan acpiapic_mp sebagai ID perangkat keras pertama dalam daftar untuk HAL. Perintah menggunakan operator penghapusan (!) untuk menghapus acpiapic_up ID perangkat keras dari daftar ID untuk HAL.

devcon sethwid @ROOT\ACPI_HAL\0000 := +acpiapic_mp !acpiapic_up

Sebagai respons, DevCon menampilkan daftar ID perangkat keras baru berikut untuk HAL:

ROOT\ACPI_HAL\0000                         : acpiapic_mp
Modified 1 hardware ID(s).

The following command uses the DevCon Update operation to update the driver for the HAL:

devcon update c:\windows\inf\hal.inf acpiapic_mp

Kemudian, DevCon menampilkan pesan keberhasilan berikut:

Updating drivers for acpiapic_mp from c:\windows\inf\hal.inf.
Drivers updated successfully.

Contoh 45: Menambahkan dan menghapus paket driver

Contoh berikut menunjukkan cara menggunakan DevCon untuk menambahkan, menghapus, dan menampilkan paket driver pihak ketiga (OEM) di penyimpanan driver.

The first command, a DevCon Dp_add operation, copies the INF file (.inf) for the Toaster sample driver in the Windows Driver Kit (WDK) to the driver store, that is, to the %Windir%\inf directory. Perintah ini mencakup jalur yang sepenuhnya memenuhi syarat ke file INF untuk driver sampel Toaster.

Perintah ini ditujukan untuk driver dan perangkat pihak ketiga (OEM), tetapi Anda dapat menggunakan sampel Toaster untuk menguji perintah-perintah tersebut.

devcon dp_add C:\WinDDK\5322\src\general\toaster\inf\i386\toaster.inf

In response, DevCon reports that it added the Toaster INF file to the driver store and named it Oem2.inf:

Driver Package 'oem2.inf' added.

Sebelum file INF disalin ke penyimpanan driver, Windows membandingkan versi biner file dengan file serupa di penyimpanan driver. Ini memeriksa untuk mengonfirmasi bahwa tidak ada file biner dengan nama INF yang sama. For example, if you repeat the command to add the Toaster.inf file to the driver store, DevCon doesn't create a new OEM*.inf file. Ini hanya melaporkan nama file yang ada, seperti yang ditunjukkan dalam output DevCon berikut:

devcon dp_add C:\WinDDK\5322\src\general\toaster\inf\i386\toaster.inf
Driver Package 'oem2.inf' added.

devcon dp_add C:\WinDDK\5322\src\general\toaster\inf\i386\toaster.inf
Driver Package 'oem2.inf' added.

To remove the driver package for the Toaster driver from the driver store, you must use the OEM*.inf file name for the driver. To find the file name for the driver, use the DevCon Dp_enum operation.

Perintah berikut mencantumkan semua paket driver OEM dan beberapa propertinya:

devcon dp_enum

Sebagai respons, DevCon menghasilkan output berikut:

c:\WinDDK\5322\tools\devcon\i386>devcon dp_enum
The following 3rd party Driver Packages are on this machine:
oem2.inf
    Provider: Microsoft
    Class: unknown

The output indicates that the driver package supplied by Microsoft with the unspecified device class (Toaster) is named OEM2.inf. Anda dapat menggunakan informasi ini untuk menghapus paket pengandar yang terkait dengan file.

The following command deletes the OEM2.inf file from the driver store, along with its associated precompiled INF (.pnf) and catalog (.cat) files. The command uses the OEM2.inf file name:

devcon dp_delete oem2.inf

Sebagai respons, DevCon menampilkan pesan yang menunjukkan keberhasilan perintah:

Driver Package 'oem2.inf' deleted.

The OEM.inf* file name is required in the DevCon Dp_delete operation. Jika Anda mencoba menggunakan nama asli file INF, perintah gagal, seperti yang ditunjukkan dalam output DevCon berikut:

devcon dp_delete C:\WinDDK\5322\src\general\toaster.inf
Deleting the specified Driver Package from the machine failed.
devcon failed.