File: devcon command line utility-Device Manager replacement option)
Applicable
The release number of this article was chs3000072
Summary
The "devcon" Utility is a command line utility that can replace the Device Manager. It allows you to enable, disable, restart, update, delete, and query a single device or a group of devices. Devcon provides information that is useful to developers but cannot be directly obtained in the Device Manager.
Devcon is designed for use on Windows 2000 and Windows XP. It cannot run on Microsoft Windows 95, Windows 98, or Windows ME.
More information
Devcon cannot be resold. It is provided for debugging and development. You can modify devcon for personal purposes at will. This example demonstrates how to effectively use setupapi and cfgmgr32 API to enumerate devices and perform device operations.
The following files can be downloaded from the Microsoft download center:
Devcon.exe
Released on: February 1, November 1, 2001
For more information about how to download microsoft support files, click the following article number to view the Microsoft Knowledge Base Article:
119591 how to obtain Microsoft support files from online services (how to obtain Microsoft support files from online services)
Microsoft has scanned this file for no virus. Microsoft used the latest virus detection software on the publication day to scan for viruses in this file. This file is stored on the security server to prevent any unauthorized changes to it.
The devcon.exe file contains the following files:
File description
I386 \ devcon.exe 32-bit devcon tool binary file. 64-bit windows will not be fully functional.
IA64 \ devcon.exe 64-bit devcon tool binary file.
Note: devcon source code and related documentation are also included in Windows xp ddk (which can be downloaded from the http://www.microsoft.com/ddk/), located under the DDK root directory \ SRC \ Setup \ devcon.
Use devcon
Devcon is a command line utility with built-in documentation. If you run the command line devcon help, the following command and description list are displayed. The command devcon HELP command provides more detailed help for any command. Some commands allow you to specify the remote target computer. You can also use the devcon 32-bit version on wow64. Device Console Help:
Devcon.exe [-R] [-M: \] [...]
-R if specified will reboot machine after command is complete, if needed.
Is name of target machine.
Is command to perform (see below ).
... Is one or more arguments if required by command.
For help on a specific command, type: devcon.exe help
Classfilter allows modification of class filters.
Classes list all Device setup classes.
Disable disable devices that match the specific hardware or
Instance id.
Driverfiles list driver files installed for devices.
Drivernodes lists all the driver nodes of devices.
Enable enable devices that match the specific hardware or
Instance id.
Find find devices that match the specific hardware or
Instance id.
Findall find devices including those that are not present.
Help display this information.
Hwids lists hardware ID's of devices.
Install manually install a device.
Listclass list all devices for a setup class.
Reboot reboot local machine.
Remove remove devices that match the specific hardware or
Instance id.
Rescan scan for new hardware.
Resources lists hardware resources of devices.
Restart restart devices that match the specific hardware or
Instance id.
Stack lists expected driver stack of devices.
Status List running status of devices.
Update manually update a device.
Devcon command example
Devcon find *
Lists the device instances of all devices on the local computer.
Devcon find PCI \*
List all known Peripheral Component Interconnect (PCI) devices on the Local Computer (this command assumes that the device is a PCI device if it has a hardware ID starting with "Tci)
Devcon-M: \ test find PCI \*
Lists All PCI devices on the computer "test. (You can use-m to specify the target computer. Permission for inter-process communication (IPC) access to the computer .)
Devcon classes
List all known installation classes. The output contains unlocalized abbreviations (for example, "USB") and descriptive names (for example, "Universal Serial Bus controllers ").
Devcon listclass USB 1394
Lists all existing devices for each specified class (USB and 1394 in this example.
Devcon find = ports * PNP *
Lists the existing devices that are members of the ports installation class and whose hardware ID contains "TNP.
Devcon find = ports @ Root \*
Lists the existing devices that are members of the ports installation class and are located in the "root" branch of the enum tree (the instance id starts with "Root ). Note that the formatting Method for instance IDs should not be any programming assumptions. To determine the root device, you can check the device status bit. To help with debugging, devcon includes this feature.
Devcon findall = ports
Lists "nonexistent" devices of the ports class and existing devices. This will include removed devices, devices that have been moved from one slot to another, and (in some cases) devices that are enumerated in different ways due to BIOS changes.
Devcon status @ PCI \*
Lists the statuses of existing devices whose instance IDs start with "PCI.
Devcon status @ ACPI \ pnp0501 \ 1-
Lists the status of a specific device instance. In this example, it is a serial port enumerated for the advanced configuration and the Power Interface (ACPI.
Devcon status @ Root \ rdp_mou/0000
Lists the statuses of Microsoft terminal servers or Terminal Services mouse drivers.
Devcon status * pnp05 *
Lists the status of all COM ports.
Devcon resources = ports
Lists the resources used by all devices in the ports installation class.
Devcon driverfiles = ports
Lists the files associated with each device in the ports installation class.
Devcon stack = ports
Lists the desired driver stack of a device. This includes high-level/low-level filters for devices and classes and control services.
Devcon drivernodes @ Root \ pci_hal \ pnp0a03
List all compatible drivers of the device "Root \ pci_hal \ pnp0a03. This can be used to determine the reason for selecting an INF file rather than a third-party INF.
Devcon remove @ USB \*
Remove all USB devices. The removed devices and their removal statuses are listed.
Devcon rescan
Scan again to find new plug-and-play devices.
Devcon update mydev. inf * pnp0501
Update all devices that exactly match the hardware ID "* pnp0501" to use the best driver associated with the hardware ID * pnp0501 in mydev. INF. Note that even if a better match already exists on the system, this forces all devices to use the driver in mydev. INF. This is useful if you want to install a new version of the driver during development before obtaining the signature. It only affects devices that match the specified hardware ID, and does not affect sub-devices. If the specified. inf file is not signed, windows may display a dialog box prompting you to confirm whether the driver should be installed. If you need to restart, you will be prompted to do so, and devcon will return the error level "1 ". If "-R" is specified, automatic restart is triggered (If yes ).
Devcon-R install Windows directory \ INF \ netloop. inf * msloop
Install a new instance of the Microsoft loopback adapter. This will create a new device node with root enumeration to allow you to install "Virtual Devices" (such as loopback adapters ). This command also restarts the computer without a prompt (if you need to restart ).
Devcon disable * msloop
Disable all devices whose hardware ID ends with "msloop" (including "* msloop.
Devcon enable '* msloop
Enable all devices whose hardware ID is "* msloop. Single quotes indicate that the hardware ID must be interpreted literally (in other words, the asterisk ["*"] is actually an asterisk; it is not a wildcard ).
Devcon restart = net @ 'root \ * msloop \ 0000
Restart the loopback adapter "Root \ * msloop \ 0000 ". Single quotes indicate that the instance id must be interpreted literally.
Devcon classfilter upper! Filter1! Filter2
Delete two specified filters.
Devcon classfilter lower! Badfilter + goodfilter
Replace "badfilter" with "goodfilter ".
Remarks
Devcon returns the error levels used in the script:
"0" indicates success.
"1" indicates that a restart is required.
"2" indicates failure.
"3" indicates a syntax error.
If-R is specified and a restart is required, all devices are restarted without warning.
If-M: \ computer is specified but this command does not work for the remote computer, an error is reported.
Devcon allows the use of wildcards in instance IDs for interaction. Do not speculate on the instance id format of another computer or another operating system version based on one computer or one operating system version.
The information in this article applies:
Microsoft Windows 2000 driver development kit (DDK)
Microsoft Windows XP driver development kit (DDK)
Last Updated: 2003-1-13 (1.1)
Keyword: kbddk kbdsupport kbfile kbgrpdsntddk kbhowto kb310472
Microsoft and/or its suppliers do not declare the applicability of files published on the server and the information contained in the graphics for any purpose. All such documents and related figures are provided "in accordance with the sample" without warranty of any nature. Microsoft and/or its suppliers hereby declare that they shall not be liable for all warranties and conditions relating to such information, such warranties and conditions include all implied warranties and conditions regarding merchantability, conformity with specific purposes, ownership and non-infringement. In all circumstances, in any lawsuit arising from or relating to the use or operation of information on the server, microsoft and/or its suppliers shall not be liable for any special, indirect or consequential losses or any type of losses caused by loss of use, data or profit, whether such litigation is a contract lawsuit, negligence or other infringement lawsuit.