次の方法で共有


Device Console (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. PnPUtil ツールは、Windows のすべてのリリースに付属しており、使用可能な最も信頼性の高い安全な API を使用します。 デバイス コンソールの代わりに PnPutil を使用する方法の詳細については、「デバイス コンソールの 交換」を参照してください。

Example categories

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

Category Examples
HwIDs 例 1: すべてのハードウェア ID を検索する
例 2: パターンを使用してハードウェア ID を検索する
例 3: クラスを使用してハードウェア ID を検索する
Classes 例 4: ローカル コンピューター上のクラスを一覧表示する
ListClass 例 6: デバイス セットアップ クラスのデバイスを一覧表示する
例 7: 複数のクラスのデバイスを一覧表示する
DriverFiles 例 8: すべてのドライバー ファイルを一覧表示する
例 9: 特定のデバイスのドライバー ファイルを一覧表示する
DriverNodes 例 10: ハードウェア ID パターン別にドライバー パッケージを一覧表示する
例 11: デバイス インスタンス ID パターン別にドライバー パッケージを一覧表示する
Resources 例 12: デバイスのクラスのリソースを一覧表示する
例 13: ID でデバイスのリソースを一覧表示する
Stack 例 14: 記憶域デバイスのドライバー スタックを表示します
例 15: デバイスのセットアップ クラスを検索します
例 16: 関連デバイスのスタックを表示する
Status 例 17: ローカル コンピューター上のすべてのデバイスの状態を表示する
例 18: デバイス インスタンス ID でデバイスの状態を表示する
例 19: 関連するデバイスの状態を表示する
Find 例 20: ハードウェア ID パターンでデバイスを検索する
例 21: デバイス インスタンス ID またはクラスでデバイスを検索する
FindAll 例 22: セットアップ クラスでデバイスを検索 (およびすべてのデバイスを検索) する
ClassFilter 例 23: セットアップ クラスのフィルター ドライバーを表示する
例 24: セットアップ クラスにフィルター ドライバーを追加する
例 25: クラスの一覧にフィルター ドライバーを挿入します
例 26: フィルター ドライバーを置き換える
例 27: フィルター ドライバーの順序を変更する
Enable 例 28: 特定のデバイスを有効にする
例 29: クラス別にデバイスを有効にする
Disable 例 30: ID パターンでデバイスを無効にする
例 31: デバイス インスタンス ID でデバイスを無効にする
Update と UpdateNI 例 32: 通信ポートのドライバーを更新します
例 44: ハードウェア抽象化レイヤー (HAL) を強制的に更新する
Install 例 33: デバイスをインストールする
例 34: 無人セットアップを使用してデバイスをインストールする
Remove 例 35: デバイス インスタンス ID パターン別にデバイスを削除する
例 36: 特定のネットワーク デバイスを削除する
Rescan 例 37: コンピューターで新しいデバイスをスキャンする
Restart 例 38: デバイスを再起動する
Reboot 例 39: ローカル コンピューターを再起動する
SetHwID 例 40: レガシ デバイスにハードウェア ID を割り当てる
例 41: すべてのレガシ デバイスにハードウェア ID を追加する
例 42: すべてのレガシ デバイスからハードウェア ID を削除する
例 43: ハードウェア ID の追加、削除、および置換
例 44: HAL を強制的に更新する
dp_add、dp_deleted、dp_enum 例 45: ドライバー パッケージの追加と削除

Example details

DevCon の完全な例については、次のセクションで説明します。

例 1: すべてのハードウェア ID を検索する

DevCon 操作では、ID と ID パターンを使用してデバイスを識別します。 その結果、DevCon を使用するための一般的な最初の手順は、コンピューター上のデバイスのハードウェア ID 参照ファイルを作成することです。

The following command uses the DevCon HwIDs operation, which returns the IDs and the device description. このコマンドでは、アスタリスク (*) ワイルドカード文字を使用して、ローカル コンピューター上のすべてのデバイスを表します。

devcon hwids *

出力は長く、繰り返し使用されるため、参照用のテキスト ファイルに出力を保存します。

次のコマンドは、前のコマンドをリダイレクト文字 (>) で拡張します。 The redirection saves the command output in the specified file, hwids.txt.

devcon hwids * > hwids.txt

例 2: パターンを使用してハードウェア ID を検索する

特定のデバイスのハードウェア ID を検索するには、コマンドを使用して次のいずれかの値を入力します。

  • ハードウェア ID またはパターン
  • 互換性のある ID またはパターン
  • デバイス インスタンス ID またはパターン
  • デバイス セットアップ クラスの名前

The following command uses the DevCon HwIDs operation and a pattern to find the hardware IDs of the floppy disk drive on the computer. (ユーザーは、パターンがいずれかのデバイス ID に表示されることを前提としています)。このコマンドでは、ワイルドカード文字 (*) を使用して、いずれかの ID で floppy 単語の前または後に続く可能性のあるすべての文字を表します。

devcon hwids *floppy*

これに対して、DevCon は、コンピューター上のフロッピー ディスク ドライブのデバイス インスタンス ID、ハードウェア ID、および互換性のある ID を表示します。 これらの ID は、後続の DevCon コマンドで使用できます。

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.

この例では、"フロッピー" という語句は、コンピューター上の 1 つのデバイスのみのハードウェア ID または互換性のある ID で発生します。 複数のデバイスの ID に語句が含まれている場合、ID に "フロッピー" という語句が含まれるすべてのデバイスが出力に表示されます。

例 3: クラスを使用してハードウェア ID を検索する

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. クラス名の前にある等号 (=) は、指定した値が ID ではなくクラスであることを示します。

devcon hwids =ports

これに対して、DevCon は Ports セットアップ クラスの 3 つのデバイスのハードウェア ID と互換性のある ID を表示します。

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.

例 4: ローカル コンピューター上のクラスを一覧表示する

DevCon 操作ではデバイス セットアップ クラスを使用してデバイスを識別できるため、コンピューター上のデバイスセットアップ クラスの参照ファイルを作成すると便利です。

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

devcon classes

出力は長く、繰り返し使用されるため、参照用のテキスト ファイルに出力を保存します。

次のコマンドは、コンピューター上のすべてのデバイス クラスを表示します。 It uses the redirection character (>) to save the command output in the specified file, classes.txt.

devcon classes > classes.txt

例 6: デバイス セットアップ クラスのデバイスを一覧表示する

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

devcon listclass net

応答として、DevCon は、Net セットアップ クラス内の各デバイスのデバイス インスタンス ID と説明を表示します。

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

コマンド応答は興味深いですが、Net セットアップ クラスのデバイスのハードウェア ID は提供されません。

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

結果の表示には、Net クラス内のデバイスが一覧表示され、デバイス インスタンス ID、ハードウェア ID、およびクラス内のデバイスの互換性 ID が含まれます。

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.

例 7: 複数のクラスのデバイスを一覧表示する

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

devcon listclass diskdrive cdrom tapedrive

これに対して、DevCon はこれらのクラスのデバイスを表示します。

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).

例 8: すべてのドライバー ファイルを一覧表示する

The following command uses the DevCon DriverFiles operation to list the file names of drivers that devices on the system use. このコマンドでは、ワイルドカード文字 (*) を使用して、システム上のすべてのデバイスを表します。 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

例 9: 特定のデバイスのドライバー ファイルを一覧表示する

The following command uses the DevCon DriverFiles operation to search for the device driver used by the mouse device on the local computer. このコマンドは、ハードウェア ID ( HID\Vid_045e&Pid_0039&Rev_0121) のいずれかでデバイスを識別します。 ハードウェア ID は、アンパサンド (&) 記号が含まれているため、引用符 (" ") で囲まれています。

devcon driverfiles "HID\Vid_045e&Pid_0039&Rev_0121"

これに対して、DevCon には、マウス デバイスをサポートする 2 つのデバイス ドライバーが表示されます。

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.

例 10: ハードウェア ID パターン別にドライバー パッケージを一覧表示する

The following command uses the DevCon DriverNodes command and an ID pattern to list the driver nodes of software-enumerated devices. パターンは、同じセットアップ クラスにない類似のデバイスに関する情報を見つけるのに役立ちます。

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*

応答として、DevCon は、システム上のソフトウェア列挙デバイスのドライバー ノードを表示します。

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.

例 11: デバイス インスタンス ID パターン別にドライバー パッケージを一覧表示する

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*

応答として、DevCon は、デバイス インスタンス ID が 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.

例 12: デバイスのクラスのリソースを一覧表示する

The following command uses the DevCon Resources operation to display the resources allocated to devices in the Hdc device setup class. このクラスには IDE コントローラーが含まれます。 構文は、クラス名 hdc の前に等号 (=) を付けて、指定した値が ID ではなくクラスであることを示します。

devcon resources =hdc

これに対して、DevCon はローカル コンピューター上の IDE コントローラーに割り当てられたリソースを一覧表示します。

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.

例 13: ID でデバイスのリソースを一覧表示する

The following command uses the DevCon Resources operation to list the resources allocated to the system timer. このコマンドは、システム タイマーのハードウェア ID ( ACPI\PNP0100) を使用して、デバイスを指定します。

devcon resources *PNP0100

応答として、DevCon はシステム タイマーのリソースを表示します。

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

次のコマンドでは、DevCon resources コマンドでシステム タイマーのデバイス インスタンス ID を使用します。 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"

例 14: 記憶域デバイスのドライバー スタックを表示する

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. 等号 (=) は、値が ID ではなくクラスであることを示す文字列の前にあります。

devcon stack =Volume

応答として、DevCon は Volume クラス内のデバイスに必要なスタックを表示します。 返されるデータには、次の情報が含まれます。

  • デバイス インスタンス ID と各デバイスの説明
  • デバイス セットアップ クラスの GUID と名前
  • 上位と下位のフィルター ドライバーの名前
  • サービスの制御 (ある場合)
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.

例 15: デバイスのセットアップ クラスを検索する

The DevCon Stack operation returns the setup class of a device in addition to the upper and lower filter drivers. 次のコマンドでは、プリンター ポート インターフェイスのセットアップ クラスを見つけるには、そのデバイス インスタンス ID を検索し、デバイス インスタンス ID を使用してそのセットアップ クラスを検索します。

The following command uses the DevCon HwIDs operation to find the device instance ID of the printer port interface. プリンター ポートハードウェア ID 内の "LPT" フレーズを検索します。

devcon hwids *lpt*

応答として、DevCon はデバイス インスタンス ID (太字で表示) とプリンター ポート インターフェイスのハードウェア ID を返します。

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 はアンパサンド (&) 記号を含んでいるため、引用符 (" ") で囲まれています。

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

応答として、DevCon は、クラスを含むプリンター ポート インターフェイスのドライバー スタックを表示します。 ディスプレイは、プリンター ポートがシステム クラスにあることを示します。

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. ハードウェア ID または互換性のある ID に "ミニポート" がある Net セットアップ クラス内のデバイスを検索します。

このコマンドは、最初に検索を Net セットアップ クラスに制限し、次に "ミニポート" 文字列を検索します。 Net セットアップ クラス内の項目以外のデバイスは見つかりません。

devcon stack =net *miniport*

応答として、DevCon はミニポート ドライバーの予期されるスタックを表示します。

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.

例 17: すべてのデバイスの状態を表示する

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. このコマンドでは、ワイルドカード文字 (*) を使用して、すべてのデバイスを表します。 It uses the redirection character (>) to save the command output in the specified file, status.txt.

devcon status * > status.txt

例 18: デバイス インスタンス ID でデバイスの状態を表示する

特定のデバイスの状態を確認する最も信頼性の高い方法は、デバイスのデバイス インスタンス ID を使用することです。

The following command uses the device instance ID of the I/O controller on the local computer in a DevCon Status command. このコマンドには、デバイスのデバイス インスタンス ID ( 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 はアンパサンド (&) 記号を含んでいるため、引用符 (" ") で囲まれています。

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

応答として、DevCon は 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. 次のデバイスが検索されます。

  • ディスクドライブ GenDisk
  • CD-ROM ドライブ、 GenCdRom
  • フロッピー ディスク ドライブ、 FDC\GENERIC_FLOPPY_DRIVE
  • ボリューム STORAGE\Volume
  • 論理ディスク マネージャー、 ROOT\DMIO
  • ボリューム マネージャー、 ROOT\FTDISK
  • フロッピー ディスク コントローラー、 ACPI\PNP0700

このコマンドでは、各 ID はスペースによって他の ID から分離されます。 GenDiskGenCdRomは互換性のある ID ですが、他の ID はハードウェア ID であることに注意してください。

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

応答として、DevCon は各デバイスの状態を表示します。

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.

例 20: ハードウェア ID パターンでデバイスを検索する

The following command uses the DevCon Find operation to search for mouse devices. 具体的には、このコマンドは、"mou" という語句を含むハードウェア ID または互換性のある ID を持つデバイスをコンピューターで検索します。

devcon find *mou*

これに対して、DevCon は次の 2 つのマウス デバイスを検出します。

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

すべての DevCon 表示操作ではハードウェア ID も検索されるため、任意の表示操作を使用してハードウェア ID を検索できます。 出力に必要なコンテンツに基づいて操作を選択します。 たとえば、ローカル コンピューターでマウス関連デバイスのデバイス ドライバーを見つけるには、次のコマンドを送信します。

devcon driverfiles *mou*

これに対して、DevCon はデバイスを検索し、ドライバーを一覧表示します。

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.

例 21: デバイス インスタンス ID またはクラスでデバイスを検索する

The following commands use the DevCon Find operation to display all legacy devices on the local computer. レガシ デバイスにはハードウェア ID がないため、デバイス インスタンス ID (レジストリ パス)、 ROOT\LEGACY、またはセットアップ クラス LegacyDriverで検索する必要があります。

最初のコマンドは、デバイス インスタンス ID パターンによってレガシ ドライバーを検索します。 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*

2 番目のコマンドは、LegacyDriver クラス内のすべてのデバイスを検索することで、レガシ デバイスを検索します。

devcon find =legacydriver

どちらのコマンドも同じ出力を生成します。この例では、同じ 27 個のレガシ デバイスを検索します。

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.

例 22: セットアップ クラスでデバイスを検索 (およびすべてのデバイスを検索) する

The following command uses the DevCon FindAll operation to find all devices on the computer in the Net setup class. 等号 (=) は、クラス名 "Net" の前に、指定した値が ID ではなくクラスであることを示します。

devcon findall =net

これに対して、DevCon は Net セットアップ クラスに次の 7 つのデバイスを一覧表示します。 最初の 6 つのデバイスは、標準的なミニポート ドライバー デバイスです。 7 番目のデバイスである RAS 非同期アダプターは、必要に応じてのみインストールされるソフトウェア列挙デバイス (SW\*) です。

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

これに対して、DevCon は Net セットアップ クラスに次の 6 つのデバイスを一覧表示します。

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.

例 23: セットアップ クラスのフィルター ドライバーを表示する

The following command uses the DevCon ClassFilter operation to display the upper filter drivers for the DiskDrive setup class. このコマンドにはクラス フィルター演算子が含まれていないため、DevCon はクラスのフィルター ドライバーを表示しますが、変更しません。

devcon classfilter DiskDrive upper

これに対して、DevCon は DiskDrive クラスの上位フィルター ドライバーを表示し、フィルター ドライバーが変更されていないことを確認します。 In this case, the display shows that devices in the DiskDrive setup class use the PartMgr.sys upper filter driver:

Class filters unchanged.
    PartMgr

例 24: セットアップ クラスにフィルター ドライバーを追加する

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.

コマンドが開始されると、仮想カーソルは最初のフィルター ドライバーの前に配置されます。 特定のドライバー上に配置されていないため、DevCon は、フィルター ドライバーの一覧の末尾に Disklog ドライバーを追加します。

このコマンドでは、 /r パラメーターも使用されます。このパラメーターは、クラス フィルターの変更を有効にするために必要に応じてシステムを再起動します。

devcon /r classfilter DiskDrive upper +Disklog

応答として、DevCon は DiskDrive クラスの現在の上位フィルター ドライバーを表示します。

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

ドライバー名のスペルを間違えたり、システムにインストールされていないドライバーを追加しようとすると、コマンドは失敗します。 DevCon は、ドライバーがサービスとして登録されていない限り、ドライバーを追加しません。 That is, DevCon only adds the driver if it has a subkey in the Services registry HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services subkey.

次のコマンドは、このセーフガード機能をテストします。 DiskDrive クラスの上位フィルターの一覧に "Disklgg" ("Disklog" ではなく) を追加しようとします。 出力は、コマンドが失敗したことを示しています。

devcon /r classfilter DiskDrive upper +Disklgg
devcon failed.

例 25: クラス一覧にフィルター ドライバーを挿入する

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

次の一覧は、コマンドが送信される前の DiskDrive クラスのフィルター ドライバーを示しています。

    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.

このコマンドでは、 /r パラメーターも使用されます。このパラメーターは、クラス フィルターの変更を有効にするために必要に応じてシステムを再起動します。

この例では、配置演算子が不可欠です。 DevCon が classfilter サブコマンドを処理する前に、仮想カーソルはリストの先頭にあり、フィルター ドライバーには配置されません。 カーソルがドライバー上に配置されていないときに add-before (+) 演算子を使用すると、DevCon によってドライバーが一覧の先頭に追加されます。 カーソルがドライバー上に配置されていないときに add-after (-) 演算子を使用すると、一覧の末尾にドライバーが追加されます。

応答として、DevCon は DiskDrive クラスの現在の上位フィルター ドライバーを表示します。

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

次のコマンドを使用して、MyFilter ドライバーを追加し、PartMgr と Disklog の間に配置することもできます。 この例では、最初のサブコマンド @PartMgrは、PartMgr フィルター ドライバーに仮想カーソルを配置します。 The second subcommand, +MyFilter, uses the add-after operator (+) to add MyFilter.sys after PartMgr:

devcon /r classfilter DiskDrive upper @PartMgr +MyFilter

例 26: フィルター ドライバーを置き換える

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

次の一覧は、コマンドが送信される前の DiskDrive クラスのフィルター ドライバーを示しています。

    PartMgr
    MyFilter
    Disklog

最初のサブコマンドは、Delete 演算子 (!、感嘆符) を使用して、DiskDrive クラスの上位フィルター ドライバーの一覧から MyFilter を削除します。 (It doesn't affect the MyFilter.sys file in the C:\Windows\System32\Drivers directory location.)

2 番目のサブコマンドは、add-after 演算子 (+) を使用して、削除されたドライバーによって以前に占有されていた位置に新しいフィルター ドライバーを配置します。 削除演算子は、削除されたフィルターが占有していた位置にカーソルを残すので、add-before (-) 演算子と add-after (+) 演算子は同じ効果を持ちます。

このコマンドでは、 /r パラメーターも使用されます。このパラメーターは、クラス フィルターの変更を有効にするために必要に応じてシステムを再起動します。

応答として、DevCon は DiskDrive クラスの新しいクラス フィルター構成を表示します。

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

例 27: フィルター ドライバーの順序を変更する

The following command uses the DevCon ClassFilter operation to change the order of filter drivers for the DiskDrive setup class. 具体的には、2 番目と 3 番目のフィルター ドライバーの順序を逆にします。

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

次の一覧は、コマンドが送信される前の DiskDrive クラスのフィルター ドライバーを示しています。 また、コマンドの意図した結果も表示されます。

Before After
PartMgr PartMgr
MyNewFilter Disklog
Disklog MyNewFilter

最初のサブコマンドでは、delete 演算子 (!) を使用して、リストから Disklog を削除します。 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. 仮想カーソルはリスト内でのみ前方に移動するため、開始演算子が必要です。 最後のサブコマンドでは、add-after 演算子 (+) を使用して、PartMgr の後に Disklog を追加します。

応答として、DevCon は DiskDrive クラスの新しいクラス フィルター構成を表示します。

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

例 28: 特定のデバイスを有効にする

The following command uses the DevCon Enable operation to enable a previously disabled programmable interrupt controller. 制御が無効になり、システムの問題を修正するために再び有効になります。 この例のコントローラー ハードウェア ID にはアスタリスク (*PNP0000) が含まれているため、コマンドは単一引用符文字 (') を使用して、コマンドで指定されているとおりに正確にハードウェア ID を検索するように DevCon に指示します。 コマンドがこのインスタンスで引用符文字 (') を使用しなかった場合、DevCon は値のアスタリスク (*) をワイルドカード文字として解釈します。

devcon enable '*PNP0000

応答として、DevCon はデバイスのデバイス インスタンス ID を表示し、デバイスを有効にするにはシステムを再起動する必要があることを説明します。

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.

次のコマンドは、 /r パラメーターを前のコマンドに追加します。 /r パラメーターは、操作を完了するために必要に応じてシステムを再起動します。

devcon /r enable '*PNP0000

これに対して、DevCon はデバイスを有効にし、システムを再起動して有効化操作を有効にします。

システムが起動したら、DevCon status コマンドを使用して、デバイスが有効になっていることを確認します。

devcon status '*PNP0000

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

例 29: クラス別にデバイスを有効にする

The following command enables all printer devices on the computer by specifying the Printer setup class in a DevCon Enable command. このコマンドには /r パラメーターが含まれており、enable 操作を有効にするために必要に応じてシステムを再起動します。

devcon /r enable =Printer

これに対して、DevCon は Printer クラスで見つかったプリンターのデバイス インスタンス ID を表示し、プリンターが有効になっていることを報告します。 コマンドには /r パラメーターが含まれていますが、プリンターを有効にするために再起動が必要ないため、システムは再起動しません。

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

例 30: ID パターンでデバイスを無効にする

The following command uses the DevCon Disable operation to disable the USB devices on the local computer. ハードウェア ID パターン (USB*) によってデバイスを識別します。 このパターンは、"USB" で始まるハードウェア ID または互換性のある ID を持つデバイスと一致します。このコマンドには /r パラメーターが含まれており、無効化操作を有効にするために必要に応じてシステムを再起動します。

Note

ID パターンを使用してデバイスを無効にする前に、影響を受ける可能性のあるデバイスを決定します。 devcon status USB*devcon hwids USB*など、表示コマンドでパターンを使用します。

devcon /r disable USB*

応答として、DevCon は USB デバイスのデバイス インスタンス ID を表示し、無効になっていることを報告します。 コマンドには /r パラメーターが含まれていますが、デバイスを無効にするために再起動が必要ないため、システムは再起動しません。

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.

例 31: デバイス インスタンス ID でデバイスを無効にする

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. 各デバイス インスタンス ID は、スペースによって他のデバイス インスタンス ID から分離されます。

デバイス ID にアンパサンド (&) 記号が含まれている場合、値は引用符 (" ") で囲まれます。 このコマンドには /r パラメーターが含まれており、無効化操作を有効にするために必要に応じてシステムを再起動します。

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

応答として、DevCon は USB デバイスのデバイス インスタンス ID を表示し、無効になっていることを報告します。 コマンドには /r パラメーターが含まれていますが、デバイスを無効にするために再起動が必要ないため、システムは再起動しません。

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.

例 32: 通信ポートのドライバーを更新する

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. このコマンドは、ハードウェア ID 全体が *PNP0501 されているデバイスにのみ影響します (アスタリスク *を含む)。

このコマンドを使用すると、システム上の署名されたドライバーをテストまたはトラブルシューティング用の代替ドライバーに置き換えたり、デバイスを同じドライバーの最新バージョンに関連付けたりすることができます。

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.

次に、DevCon に次の成功メッセージが表示されます。

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. その結果、DevCon はドライバーを更新できないため、エラー メッセージが表示されます。

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

例 33: デバイスをインストールする

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

これに対して、DevCon はデバイスがインストールされたことを報告します。 つまり、DevCon は新しいデバイスのデバイス ノードを作成し、デバイスのドライバー ファイルを更新します。

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

例 34: 無人セットアップを使用してデバイスをインストールする

次の例は、Microsoft Windows XP の無人インストール中に Microsoft ループバック アダプターをインストールする方法を示しています。

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).

次に、無人セットアップ ファイルの [GUIRunOnce] セクションに次の DevCon コマンドを追加します。

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

このコマンドは、ハードウェア ID ( *MSLOOP) を使用してループバック アダプターを識別します。 値\*MSLOOP前の単一引用符文字 (') は、文字列をリテラルで解釈するように DevCon に通知します。 その結果、DevCon はアスタリスク (*) をワイルドカード文字ではなくハードウェア ID の一部として解釈します。

The command also specifies that DevCon use the Netloop.inf file (on the floppy disk) in the installation. /r パラメーターは、インストールを完了するために必要に応じてコンピューターを再起動します。

最後に、無人セットアップ ファイルにネットワーク構成設定を追加し、無人セットアップを実行します。

例 35: デバイス インスタンス ID パターンによるデバイスの削除

The following command uses the DevCon Remove operation to remove all USB devices from the computer. "USB" 文字列で始まるデバイス インスタンス ID (レジストリ パス) と一致するデバイス インスタンス ID パターンによってデバイスを識別します。 The command uses the at symbol (@) to distinguish the device instance ID from a hardware ID or compatible ID. このコマンドには、削除を有効にするために必要に応じてシステムを再起動する /r パラメーターも含まれています。

Warning

ID パターンを使用してデバイスを削除する前に、影響を受ける可能性のあるデバイスを決定します。 devcon status @usb\*devcon hwids @usb\*など、表示コマンドでパターンを使用します。

devcon /r remove @usb\*

応答として、DevCon は削除されたデバイスのデバイス インスタンス ID を表示します。

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.

例 36: 特定のネットワーク デバイスを削除する

The following command uses the DevCon Remove operation to uninstall the NDISWAN miniport driver from the local computer. このコマンドは、Net クラスを指定し、ハードウェア ID または互換性 ID に "ndiswan" が含まれるクラス内のデバイスを指定して検索を絞り込みます。このコマンドには、 /r パラメーターも含まれています。このパラメーターは、削除を有効にするために必要に応じてシステムを再起動します。

Warning

ID パターンを使用してデバイスを削除する前に、影響を受ける可能性のあるデバイスを決定します。 devcon status =net *ndiswandevcon hwids =net *ndiswan*など、表示コマンドでパターンを使用します。

devcon /r remove =net *ndiswan*

応答として、DevCon は削除されたデバイスのデバイス インスタンス ID を表示します。

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

例 37: コンピューターで新しいデバイスをスキャンする

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

devcon rescan

これに対して、DevCon はシステムをスキャンしたが、新しいデバイスが見つからなかったことを報告します。

Scanning for new hardware.
Scanning completed.

例 38: デバイスを再起動する

The following command uses the DevCon Restart operation to restart the loopback adapter on the local computer. このコマンドは、検索を Net セットアップ クラスに制限し、そのクラス内でループバック アダプターのデバイス インスタンス ID を指定 @'ROOT\*MSLOOP\0000

The at symbol (@) identifies the string value as a device instance ID. 単一引用符文字 (') は、文字列をリテラルで解釈するように DevCon に通知します。 その結果、DevCon はアスタリスク (*) をワイルドカード文字ではなく ID の一部として解釈します。

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

応答として、DevCon はデバイスのデバイス インスタンス ID を表示し、結果を報告します。

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

例 39: ローカル コンピューターを再起動する

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.

このコマンドは、システムの再起動を必要とするスクリプトおよびバッチ ファイルに含めることができます。

devcon reboot

応答として、DevCon は、コンピューターの再起動 (ローカル コンピューターの再起動) を示すメッセージを表示します。

DevCon uses the standard ExitWindowsEx function to reboot. ユーザーがコンピューター上でファイルを開いているか、プログラムが閉じない場合、システムは再起動しません。 ユーザーがシステム プロンプトに応答してファイルを閉じるか、プロセスを終了するまで待機します。

例 40: レガシ デバイスにハードウェア ID を割り当てる

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

このコマンドは、ビープ音レガシ デバイスにハードウェア ID または互換性のある ID がないため、デバイス ROOT\LEGACY_BEEP\0000 のデバイス インスタンス ID を使用します。 The command uses the at symbol (@) to indicate that the string is a device instance ID.

このコマンドでは、ID の配置にシンボル パラメーターは使用されません。 既定では、DevCon は新しいハードウェア ID をハードウェア ID リストの末尾に追加します。 この場合、デバイスには他のハードウェア ID がないため、ID の配置は関係ありません。

devcon sethwid @ROOT\LEGACY_BEEP\0000 := beep

応答として、DevCon はデバイスのハードウェア ID リストに beep を追加したことを示すメッセージを表示します。 また、結果として得られるハードウェア ID の一覧も表示されます。 この場合、一覧に含まれるハードウェア ID は 1 つだけです。

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

例 41: すべてのレガシ デバイスにハードウェア ID を追加する

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

このコマンドでは、マイナス記号 (-) パラメーターを使用して、デバイスのハードウェア ID 一覧の末尾に新しいハードウェア ID を追加します(いずれかのデバイスに優先ハードウェア ID が存在する場合)。 また、デバイス インスタンス ID パターン ( @ROOT\LEGACY*) を使用して、コンピューター上のレガシ デバイス、つまり、 ROOT\LEGACY*で始まるデバイス インスタンス ID を持つすべてのデバイスを識別します。

devcon sethwid @ROOT\LEGACY* := -legacy

これに対して、DevCon は影響を受けるすべてのデバイスの結果のハードウェア ID リストを表示します。

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).

デバイスのグループに同じハードウェア ID を割り当てた後は、他の DevCon 操作を使用して、1 つのコマンドでデバイスを表示および変更できます。

たとえば、次のコマンドは、すべてのレガシ デバイスの状態を表示します。

devcon status legacy

例 42: すべてのレガシ デバイスからハードウェア ID を削除する

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

このコマンドでは、ハードウェア ID legacy を使用して、そのハードウェア ID を持つすべてのデバイスを識別します。 delete 演算子 (!) を使用して、 legacy ハードウェア ID を削除します。

devcon sethwid legacy := !legacy

これに対して、DevCon は影響を受けるすべてのデバイスの結果のハードウェア ID リストを表示します。

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).

例 43: ハードウェア ID の追加、削除、および置換

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. デバイスに対して DevCon コマンドを実行する前に、デバイスには次のハードウェア ID の一覧があります。

Hw3 Hw4

次のコマンドでは、プラス記号 (+) を使用して、 Hw1 ID 値を追加し、DeviceX のハードウェア ID の一覧の先頭に Hw2 します。 Hw2 ID は既に一覧に表示されるため、ID 値は移動され、追加されません。 The command uses the at symbol (@) to identify the device by its device instance ID.

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

これに対して、DevCon はデバイスの新しいハードウェア ID リストを表示します。 Hw1Hw2 ID の値は、ID リストの先頭に指定した順序で表示されます。

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

また、DevCon は、1 つのハードウェア ID リスト (つまり、1 つのデバイスのハードウェア ID リスト) を変更したことを報告します。

次のコマンドでは、delete 演算子 (!) を使用して、 Hw1 ハードウェア ID を削除します。 次に、シンボル パラメーターを指定せずにハードウェア ID Hw5 を一覧表示します。 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

応答として、DevCon は DeviceX の結果のハードウェア ID リストを表示します。

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

次のコマンドでは、equals (=) パラメーターを使用して、DeviceX の一覧内のすべてのハードウェア ID を単一のハードウェア ID DevXに置き換えます。

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

応答として、DevCon は DeviceX の結果のハードウェア ID リストを表示します。

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

成功メッセージは、DevCon が 1 つのデバイスのハードウェア ID を変更したことを示します。

例 44: HAL を強制的に更新する

次の例は、DevCon を使用してコンピューター上の HAL を更新する方法を示しています。 現在の HAL は、コンピューターに応じて、Advanced Configuration and Power Interface (ACPI) とAdvanced Programmable Interrupt Controller (APIC) を使用して構築されたユニプロセッサ (_up) です。 テスト担当者は、テスト目的でマルチプロセッサ (_mp) ACPI APIC HAL に型を変更したいと考えています。

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. このコマンドでは、プラス記号 (+) を使用して、HAL の一覧の最初のハードウェア ID として acpiapic_mp を指定します。 このコマンドは、delete 演算子 (!) を使用して、HAL の ID の一覧から acpiapic_up ハードウェア ID を削除します。

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

応答として、DevCon は HAL の次の新しいハードウェア ID リストを表示します。

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

次に、DevCon に次の成功メッセージが表示されます。

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

例 45: ドライバー パッケージの追加と削除

次の例では、DevCon を使用して、ドライバー ストアにサード パーティ (OEM) ドライバー パッケージを追加、削除、および表示する方法を示します。

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. このコマンドには、トースター サンプル ドライバーの INF ファイルへの完全修飾パスが含まれています。

このコマンドはサード パーティ (OEM) ドライバーとデバイスを対象としていますが、トースター サンプルを使用してコマンドをテストできます。

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.

INF ファイルがドライバー ストアにコピーされる前に、Windows はファイルのバイナリ バージョンをドライバー ストア内の同様のファイルと比較します。 同じ INF 名を持つバイナリ ファイルがないことを確認します。 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. 次の DevCon 出力に示すように、既存のファイルの名前のみが報告されます。

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.

次のコマンドは、すべての OEM ドライバー パッケージとそのプロパティの一覧を示します。

devcon dp_enum

これに対して、DevCon は次の出力を生成します。

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. この情報を使用して、ファイルに関連付けられているドライバー パッケージを削除できます。

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

応答として、DevCon はコマンドの成功を示すメッセージを表示します。

Driver Package 'oem2.inf' deleted.

The OEM.inf* file name is required in the DevCon Dp_delete operation. INF ファイルの元の名前を使用しようとすると、次の DevCon 出力に示すようにコマンドが失敗します。

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