茫茫網海中的冷日
         
茫茫網海中的冷日
發生過的事,不可能遺忘,只是想不起來而已!
 恭喜您是本站第 1672326 位訪客!  登入  | 註冊
主選單

Google 自訂搜尋

Goole 廣告

隨機相片
IMG_60D_00089.jpg

授權條款

使用者登入
使用者名稱:

密碼:


忘了密碼?

現在就註冊!

微軟帝國 : [轉貼]另一種方法來 「 裝置管理員 」 之 DevCon 命令列公用程式函式

發表者 討論內容
冷日
(冷日)
Webmaster
  • 註冊日: 2008/2/19
  • 來自:
  • 發表數: 15771
[轉貼]另一種方法來 「 裝置管理員 」 之 DevCon 命令列公用程式函式
DevCon 公用程式是做為替代裝置管理員的命令列公用程式。
使用 DevCon,您可以啟用、 停用、 重新啟動、 更新、 移除及查詢個別裝置群組。DevCon 也提供相關的驅動程式開發人員,也不在 「 裝置管理員 」 中可用的資訊。

您可以使用 DevCon Microsoft Windows 2000、 Windows XP 與 Windows Server 2003。您不能使用 DevCon Windows 95、 Windows 98 或精簡。

DevCon 不是可轉散發的。它被提供作為偵錯和開發工具。您可以自由修改 DevCon,私用的。本範例示範如何在一起使用的 SetupAPI 和 CfgMgr32 的函式有效地以列舉裝置,並執行裝置作業。下列檔案是可以從 「 Microsoft 下載中心 」 下載:
立即下載 DevCon 套件。發行日期: 2003 年 1 月 29 日

如需有關如何下載 Microsoft 支援檔案的詳細資訊,請按一下下面的文件編號,檢視「Microsoft 知識庫」中的文件:
119591如何從線上服務取得 Microsoft 的支援檔案
Microsoft 會掃描這個檔案有無病毒。Microsoft 會使用已張貼檔案的日期中的可用的最新病毒偵測軟體。檔案會儲存在加強保全的伺服器,以避免任何未經授權的更改。

DevCon.exe 檔案包含下列檔案:
檔案	                  描述
I386\DevCon.exe	32 位元 DevCon 工具二進位。這不會完全在 64 位元 Windows 上。
Ia64\DevCon.exe	64 位元 DevCon 工具二進位。

注意DevCon 的程式碼也是用於 Windows DDK (也就是可以從http://www.microsoft.com/whdc/devtools/ddk/default.mspx) 下DDK root\Src\Setup\Devcon,以及文件。

使用 DevCon
DevCon 是內建文件的命令列公用程式。如果您執行devcon 說明] 命令時,會出現下列的命令和說明的清單。Devcon 說明] 命令將會提供更詳細的說明上的任何命令。使用其中某些命令,您可以指定遠端目標電腦。如果您在 WOW64 上使用 DevCon 32 位元版本,就會使用這些命令。
Device Console Help:
devcon.exe [-r] [-m:\\<machine>] <command> [<arg>...]
-r if specified will reboot machine after command is complete, if needed.
<machine> is name of target machine.
<command> is command to perform (see below).
<arg>... is one or more arguments if required by command.
For help on a specific command, type: devcon.exe help <command>
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.
UpdateNI            Manually update a device without user prompt
SetHwID              Adds, deletes, and changes the order of hardware IDs of root-enumerated devices.


範例 DevCon 命令
devcon -m:\\test 到 pci\ *

列出所有已知的 PCI 裝置上test的電腦。(藉由使用-m,您可以指定目標電腦。您必須使用處理序間通訊 (IPC) 存取的電腦)。

devcon -r安裝%WINDIR%\Inf\Netloop.inf * MSLOOP

安裝 Microsoft 迴路介面卡的新執行個體。這會建立新的根列舉裝置節點,您可以安裝 「 虛擬裝置 」,例如迴路介面卡。這個命令也會重新啟動電腦以無訊息模式需要重新啟動電腦時。

devcon 類別

列出所有已知的安裝程式類別。為輸出中包含簡短的非當地語系化名稱 (例如,"USB 」) 以及描述性的名稱 (例如,「 通用序列匯流排控制器 」)。

左上角的 devcon classfilter! filter1! filter2

刪除兩個指定的篩選器。

較低的 devcon classfilter! badfilter + goodfilter

以"goodfilter"取代"badfilter"。

devcon driverfiles = 連接埠

列出連接埠安裝程式類別中的每個裝置相關聯的檔案。

devcon 停用 * MSLOOP

停用所有具有以"MSLOOP"結尾的硬體識別碼的裝置 (包括 「 * MSLOOP")。

devcon drivernodes @ROOT\PCI_HAL\PNP0A03

列出所有相容的驅動程式裝置ROOT\PCI_HAL\PNP0A03。這可以用來判斷為何整數類資料的裝置資訊 (.inf) 檔案選擇,而不是協力廠商.inf 檔案。

devcon 啟用 ' * MSLOOP

可讓所有的裝置要有的硬體 ID"* MSLOOP 」。單引號指出的硬體識別碼必須其字面 (換句話說,星號 ["*"] 實際上星號 ; 它並不是萬用字元)。

尋找 devcon *

列出已存在於本機電腦上的所有裝置的裝置例項。

devcon 尋找 pci\ *

列出在 (這個命令會假設裝置是 PCI,如果它以"PCI\"當做前置字元的硬體識別碼) 的本機電腦上的所有已知的周邊元件互連 (PCI) 裝置。

devcon 尋找連接埠 = * pnp *

所出現的清單裝置都以及連接埠安裝類別的成員包含"PNP",其硬體識別碼。

尋找 devcon = 連接埠 @root\*

出現的清單裝置,是連接埠安裝類別和該會列舉樹狀目錄 (執行個體識別碼以"root\"當做前置字元) 的 「 根 」 分支中的成員。請注意您應該不會讓任何程式化的假設,關於如何格式化執行個體識別碼。如果要判斷根裝置,您可以查看裝置狀態位元。這項功能會包含在 DevCon 來協助偵錯。

devcon findall = 連接埠

列出 「 出現 「 裝置及連接埠類別存在的裝置。這包括已經移除的裝置、 已從一個位置移動到另一個,並在某些情況下的裝置都已列舉的 BIOS 變更不同到期的裝置。

devcon listclass 1394 usb

列出所有存在名為每個類別 (在這種情況下,USB 和 1394年) 的裝置。

devcon 移除 @usb\*

移除所有 USB 裝置。移除的裝置會列出其 [移除] 狀態。

devcon 重新掃描

重新掃瞄為新的隨插即用裝置。

devcon 資源 = 連接埠

列出連接埠安裝程式類別中的所有裝置所使用的資源。

devcon 重新啟動 = 網路 @' ROOT\ * MSLOOP\0000

重新啟動迴路介面卡ROOT\ * MSLOOP\0000。單一的雙引號記號,在命令中表示的執行個體識別碼必須其字面。

devcon hwids = 滑鼠

列出所有硬體的系統上的滑鼠類別裝置的識別碼。

devcon sethwid @ROOT\LEGACY_BEEP\0000: = 嗶聲

指派的硬體識別碼,會發出嗶聲,舊版的嗶聲裝置。

devcon 堆疊 = 連接埠

列出裝置的預期的驅動程式堆疊。這包括裝置和類別上層/較低篩選,以及控制服務。

devcon 狀態 @pci\*

列出每個裝置的存在具有以"pci\"開頭的執行個體 ID 的狀態。

devcon 狀態 @ACPI\PNP0501\1

進階設定及電源介面 ACPI 列舉序列連接埠,請列出特定裝置的執行個體,在這種情況下的狀態。

devcon 狀態 @root\rdp_mou\0000

列出 Microsoft 「 終端機伺服器 」 或 「 終端機服務滑鼠驅動程式的狀態。

devcon 狀態 * PNP05 *

列出所有的 COM 連接埠的狀態。

devcon 更新 mydev.inf * pnp0501

更新所有完全符合硬體識別碼的裝置* pnp0501用於最好的驅動程式硬體識別碼與相關聯的 Mydev.inf 中* pnp0501。

注意此更新程式會強制所有的裝置驅動程式用於 Mydev.inf,即使有更好的符合項目已經在系統上。當您要安裝新版本的驅動程式在開發期間,才能取得簽章時,這是很有用。更新會影響只有符合指定的硬體識別碼的裝置,而不會影響子裝置。如果指定的.inf 檔案是不帶正負號的 Windows 可能會顯示一個對話方塊,提示您確認是否要安裝驅動程式。如果需要重新啟動電腦,這報告和 DevCon 傳回層級 1 的錯誤。如果您指定-r,這會導致自動發生,如果需要重新啟動電腦。
注意事項

DevCon 將傳回的錯誤層級,用於指令碼中:
"0"表示成功。
"1"表示不需要重新啟動電腦。
"2"表示失敗。
"3"表示語法錯誤。
如果指定-r ,必須重新啟動,而不警告之後在處理完所有的裝置就會發生在重新啟動。
如果您指定-m:\\computer和命令不適用於遠端電腦,報告錯誤。
DevCon 允許互動式方便的執行個體識別碼中的萬用字元。請不要假設從電腦到電腦和作業系統版本的作業系統版本的執行個體 ID 的格式相關的任何項目。

回此頁最上方 | 提供意見
Collapse image屬性
文章編號: 311272 - 上次校閱: 2006年1月5日 - 版次: 5.0
這篇文章中的資訊適用於:

Microsoft Win32 Device Driver Kit for Windows 2000
Microsoft Windows XP Driver Development Kit
Microsoft Windows Server 2003 Driver Development Kit (DDK)

關鍵字:
kbmt kbfile kbhowto KB311272 KbMtzh
機器翻譯
重要:本文是以 Microsoft 機器翻譯軟體翻譯而成,而非使用人工翻譯而成。Microsoft 同時提供使用者人工翻譯及機器翻譯兩個版本的文章,讓使用者可以依其使用語言使用知識庫中的所有文章。但是,機器翻譯的文章可能不盡完美。這些文章中也可能出現拼字、語意或文法上的錯誤,就像外國人在使用本國語言時可能發生的錯誤。Microsoft 不為內容的翻譯錯誤或客戶對該內容的使用所產生的任何錯誤或損害負責。Microsoft也同時將不斷地就機器翻譯軟體進行更新。
按一下這裡查看此文章的英文版本:311272
Microsoft及(或)其供應商不就任何在本伺服器上發表的文字資料及其相關圖表資訊的恰當性作任何承諾。所有文字資料及其相關圖表均以「現狀」供應,不負任何擔保責任。Microsoft及(或)其供應商謹此聲明,不負任何對與此資訊有關之擔保責任,包括關於適售性、適用於某一特定用途、權利或不侵權的明示或默示擔保責任。Microsoft及(或)其供應商無論如何不對因或與使用本伺服器上資訊或與資訊的實行有關而引起的契約、過失或其他侵權行為之訴訟中的特別的、間接的、衍生性的損害或任何因使用而喪失所導致的之損害、資料或利潤負任何責任。

原文出處:另一種方法來 「 裝置管理員 」 之 DevCon 命令列公用程式函式
冷日
(冷日)
Webmaster
  • 註冊日: 2008/2/19
  • 來自:
  • 發表數: 15771
[轉貼]DevCon 命令列公用程式功能可替代裝置管理員
[Windows] DevCon 命令列公用程式功能可替代裝置管理員
The DevCon command-line utility functions as an alternative to Device Manager
引用:
The DevCon utility is a command-line utility that acts as an alternative to Device Manager. Using DevCon, you can enable, disable, restart, update, remove, and query individual devices or groups of devices. DevCon also provides information that is relevant to the driver developer and is not available in Device Manager.

由於小弟習慣以休眠取代關機, 當多次休眠重啟之後, 難免硬體裝置會出現一些問題, 尤其是當執行許多需要耗費記憶體的應用程式之後, Windows 需要頻繁將應用程式所使用的記憶體置換到硬碟之中, 而當下次休眠重啟之後, 此時最容易產生部份硬體無法正常啟動的情形, 尤其是對於網路介面卡而言, 最好的解決方法當然就是重新開機, 但如果嫌麻煩的話, 倒是可以利用DevCon 命令列公用程式解決, 以下示範操作流程

請先下載 devcon.exe, 執行後會解壓縮得到32-bit 和64-bit 版本, 請將適合您的版本移到%SystemRoot%\system32 之下

開啟命令提示字元, 然後執行 "devcon help" 可以顯示參數說明:
語法:

c:\>devcon help
Device Console Help:
devcon [-r] [-m:\\<machine>] <command> [<arg>...]
-r if specified will reboot machine after command is complete, if needed.
<machine> is name of target machine.
<command> is command to perform (see below).
<arg>... is one or more arguments if required by command.
For help on a specific command, type: devcon help <command>
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.
sethwid Modify Hardware ID's of listed root-enumerated devices.
stack Lists expected driver stack of devices.
status List running status of devices.
update Manually update a device.
updateni Manually update a device (non interactive).


網路卡屬於PCI 介面卡之一, 請先由裝置管理員確認發生問題的網路卡, 然後執行 "devcon findall pci*"
語法:
c:\>devcon findall pci*
PCI\VEN_10EC&DEV_8139&SUBSYS_813910EC&REV_10\3&61AAA01&0&40 : Realtek RTL8139 Family PCI Fast Ethernet NIC
PCI\VEN_1106&DEV_0571&SUBSYS_05711106&REV_06\3&61AAA01&0&89 : VIA Bus Master IDE Controller
PCI\VEN_1106&DEV_3038&SUBSYS_30381106&REV_80\3&61AAA01&0&80 : VIA Rev 5 or later USB Universal Host Controller
PCI\VEN_1106&DEV_3038&SUBSYS_30381106&REV_80\3&61AAA01&0&81 : VIA Rev 5 or later USB Universal Host Controller
PCI\VEN_1106&DEV_3059&SUBSYS_45521106&REV_50\3&61AAA01&0&8D : Vinyl AC'97 CodecCombo Driver (WDM)
PCI\VEN_1106&DEV_3065&SUBSYS_30651106&REV_74\3&61AAA01&0&90 : VIA Rhine II FastEthernet Adapter
PCI\VEN_1106&DEV_3104&SUBSYS_31041106&REV_82\3&61AAA01&0&83 : VIA USB Enhanced Host Controller
PCI\VEN_1106&DEV_3122&SUBSYS_31221106&REV_03\4&26E5833C&0&0008: VIA/S3G UniChrome IGP
PCI\VEN_1106&DEV_3123&SUBSYS_00000000&REV_00\3&61AAA01&0&00 : PCI standard hostCPU bridge
PCI\VEN_1106&DEV_3177&SUBSYS_00000000&REV_00\3&61AAA01&0&88 : PCI standard ISA bridge
PCI\VEN_1106&DEV_B091&SUBSYS_00000000&REV_00\3&61AAA01&0&08 : VIA CPU to AGP Controller
PCI\VEN_1217&DEV_6972&SUBSYS_69721217&REV_00\3&61AAA01&0&48 : O2Micro OZ6912 CardBus Controller
PCI\VEN_168C&DEV_001A&SUBSYS_000E17F9&REV_01\3&61AAA01&0&50 : Atheros AR5005G Wireless Network Adapter
13 matching device(s) found.


假設有問題的裝置是Atheros 無線網卡, 接著利用剪貼然後執行 devcon hwids "PCI\VEN_168C&DEV_001A"
語法:
c:\>devcon hwids "PCI\VEN_168C&DEV_001A"
PCI\VEN_168C&DEV_001A&SUBSYS_000E17F9&REV_01\3&61AAA01&0&50
Name: Atheros AR5005G Wireless Network Adapter
Hardware ID's:
PCI\VEN_168C&DEV_001A&SUBSYS_000E17F9&REV_01
PCI\VEN_168C&DEV_001A&SUBSYS_000E17F9
PCI\VEN_168C&DEV_001A&CC_020000
PCI\VEN_168C&DEV_001A&CC_0200
Compatible ID's:
PCI\VEN_168C&DEV_001A&REV_01
PCI\VEN_168C&DEV_001A
PCI\VEN_168C&CC_020000
PCI\VEN_168C&CC_0200
PCI\VEN_168C
PCI\CC_020000
PCI\CC_0200
1 matching device(s) found.


請剪貼Compatible ID's 的前一個字串, 然後執行 devcon restart "PCI\VEN_168C&DEV_001A&CC_0200", 這麼做的目的是避免影響其他不相干的裝置, 但是如果您的裝置包含兩片以上類似的網卡, 那麼Hardware ID 字串愈長愈不容易選到錯誤的裝置
語法:
c:\>devcon restart "PCI\VEN_168C&DEV_001A&CC_0200"
PCI\VEN_168C&DEV_001A&SUBSYS_000E17F9&REV_01\3&61AAA01&0&50 : Restarted
1 device(s) restarted.


如果看見 "1 device(s) restarted.", 則代表指令正確, 請把指令複製下來, 然後在桌面上建立一個捷徑, 或者貼到開始->執行, 再執行一次, 以方便下回不需要再重複以上步驟


如果休眠只是讓網卡出問題, 那倒還好, 若是導致Windows 死當, 那就不妙了, 尤其USB 無線網卡更容易發生以上情形, 請安裝Windows KB941036



原文出處: [Windows] DevCon 命令列公用程式功能可替代裝置管理員 - PCZONE 討論區
冷日
(冷日)
Webmaster
  • 註冊日: 2008/2/19
  • 來自:
  • 發表數: 15771
[轉貼]使用 Devcon 安裝 Windows Driver

使用Devcon 安裝 Windows Driver

Devon是Microsoft所Release的一個Tool
能夠透過下command的方法去安裝一個Driver



devcon.exe [-r] [-m:\\]  [...]
devcon /m:\\server01 =>/m 代表是remote的machine
devcon /r 代表command執行完後需要reboot


  1. 列出所有的 HWID 並存進 hwids.txt
devcon hwids * > hwids.txt 
  1. 列出符合某個 Pattern HWID
devcon hwids *floppy*

  1. 列出所有的 class
devcon classes > classes.txt
  1. class HWID( 這裡用 ports class)
devcon hwids =ports

  1. 列出某個 class device( 這裡用 net class)
devcon listclass net
  1. 列出很多個 class device

devcon listclass diskdrive cdrom tapedrive 
  1. 列出所有個 driverfile 存進 driverfiles.txt
devcon driverfiles * > driverfiles.txt 
  1. 列出 device status

devcon status * > status.txt
  1. 透過 Instance ID 列出某個 device status
devcon status "@PCI\VEN_8086&DEV_1130&SUBSYS_00000000&REV_02\3&29E81982&0&00"
  1. 找出所有的
    device 存進 findall.txt
devcon findall * > findall.txt
  1. 透過 INF file   HWID 
    update  某隻 driver
devcon update c:\windows\inf\test.inf *PNP0501 
  1. 透過
    INF file   HWID  install  某隻 driver
devcon /r install c:\windows\inf\keyboard.inf *PNP030b 

  1. 透過 Instance ID  移除 device
devcon /r remove @usb\*   

  1. 透過 class   HWID  移除特定一隻 device
devcon /r remove =net *ndiswan*  

  1. 重新 scan device
devcon rescan


原文出處:William的記事: 使用Devcon 安裝 Windows Driver
前一個主題 | 下一個主題 | 頁首 | | |



Powered by XOOPS 2.0 © 2001-2008 The XOOPS Project|