系統(tǒng)沒有WMI服務(wù),或網(wǎng)路適配器共享時提示W(wǎng)MI錯誤等均可使用。 使用方法:復制并保存為wmi.bat @echo on cd /d c:\temp if not exist %windir%\system32\wbem goto TryInstall cd /d %windir%\system32\wbem net stop winmgmt winmgmt /kill if exist Rep_bak rd Rep_bak /s /q ...
首先要在VS.NET中創(chuàng)建一個項目,然后在添加引用中引用一個.net的裝配件:System.Management.dll,這樣你的項目才能使用WMI。代碼如下: using System; using System.Management; class Sample_ManagementObject { public static int Main(string[] args) { SelectQuery query=new SelectQuery("Select * From Win32_Logic...