wmic命令通過別名、操作和條件查詢系統(tǒng)信息並執(zhí)行管理任務(wù),1. 輸入wmic進(jìn)入交互環(huán)境或直接運(yùn)行命令;2. 常用別名包括computersystem、os、cpu、process、service等,用於獲取系統(tǒng)、硬件、進(jìn)程和服務(wù)信息;3. 使用where子句過濾結(jié)果,如按內(nèi)存使用或服務(wù)狀態(tài)篩選;4. 支持list、csv、xml等輸出格式,推薦在非交互模式下使用;5. 注意其不區(qū)分大小寫、不支持通配符但可用like匹配、性能較慢且已被PowerShell取代;6. 在wmic提示符下輸入exit退出。儘管已棄用,wmic仍適用於無PowerShell環(huán)境的快速診斷和腳本任務(wù)。
The wmic
(Windows Management Instrumentation Command-line) utility is a powerful tool in Windows that allows you to query system information, manage processes, services, hardware, and more—all from the command line. Although Microsoft has started deprecating wmic
in favor of PowerShell, it's still available and widely used in many environments, especially for scripting and troubleshooting.

Here's how to use the wmic
command effectively:
1. Accessing WMIC
Open Command Prompt with administrative or standard user privileges:

- Press
Win R
, typecmd
, and press Enter. - Type
wmic
and press Enter to enter the WMIC shell.
C:\> wmic
You'll see the prompt change to wmic:root\cli>
, indicating you're inside the WMIC environment.
Alternatively, you can run wmic
commands directly without entering the shell:

wmic [alias] [command] [parameters]
2. Common WMIC Aliases and Usage Examples
WMIC organizes system data into aliases , which represent different types of system components. Here are some of the most useful ones:
System Information (Computer System)
Get basic system details like model, manufacturer, and number of CPUs.
wmic computersystem get name, manufacturer, model, numberofprocessors, totalphysicalmemory
Operating System Info
Check OS version, install date, and architecture.
wmic os get caption, version, csdversion, installdate, osarchitecture
Processor Details
Get CPU name, number of cores, and clock speed.
wmic cpu get name, numberofcores, maxclockspeed
Installed Hotfixes (Updates)
List all applied Windows updates.
wmic qfe get caption, description, hotfixid, installedon
Useful for troubleshooting or verifying patch levels.
Running Processes
List all running processes or kill a process by name/PID.
List processes:
wmic process get name, processid, caption
Kill a process by name (eg, notepad.exe):
wmic process where name="notepad.exe" delete
Kill by PID:
wmic process where processid=1234 delete
Startup Programs
List programs that run at startup.
wmic startup get caption, command, location
Service Management
Check service status or start/stop services.
List all services:
wmic service get name, displayname, state, startmode
Start a service:
wmic service where name="Spooler" call startservice
Stop a service:
wmic service where name="Spooler" call stopservice
Disk and Partition Info
Get details about logical disks and partitions.
Disk drives:
wmic logicaldisk get deviceid, volumename, freespace, size
Partition info:
wmic partition get deviceid, type, bootable, size
BIOS Information
Check BIOS version and manufacturer.
wmic bios get serialnumber, manufacturer, smbiosbiosversion
Often used for asset tracking.
User Accounts
List local user accounts.
wmic useraccount get name, disabled, localaccount, sid
Filter only local accounts:
wmic useraccount where localaccount=true get name
3. Using Filters (WHERE Clause)
You can filter results using the where
keyword, similar to SQL.
Examples:
Find processes using more than 100 MB of memory:
wmic process where "workingsetsize > 100000000" get name, workingsetsize
Find services that are currently running:
wmic service where state="running" get name, displayname
Find a specific service:
wmic service where name="winrm" get state, startmode
4. Output Formats
By default, WMIC outputs in table format. You can change the output format:
List format:
wmic /format:list os get caption, version
CSV format:
wmic /format:csv logicaldisk get deviceid, freespace > diskinfo.csv
XML format:
wmic /format:xml process get name > processes.xml
Note: Some formats may not work well in the WMIC shell—better used in direct command mode.
5. Tips and Limitations
- Case Insensitive : WMIC commands are generally case-insensitive.
- No Wildcards in WHERE : You can't use
*
inwhere
clauses. Uselike
for pattern matching:wmic process where "name like 'chrome%'" get name, processid
- Performance : Some queries (eg,
wmic process list full
) can be slow. - Deprecated : Microsoft recommends using PowerShell (eg,
Get-WmiObject
,Get-CimInstance
) instead.
6. Exit WMIC Shell
If you entered the WMIC environment, type:
exit
to return to the regular command prompt.
While wmic
is being phased out, it remains a quick and effective tool for gathering system data and performing management tasks—especially in legacy scripts or environments where PowerShell isn't available.
Basically, just remember: wmic [alias] [verb] [where clause] [get/format]
. Once you know a few key aliases, it becomes a fast way to pull system info without installing extra tools.
以上是如何在Windows中使用WMIC命令行實(shí)用程序的詳細(xì)內(nèi)容。更多資訊請(qǐng)關(guān)注PHP中文網(wǎng)其他相關(guān)文章!

熱AI工具

Undress AI Tool
免費(fèi)脫衣圖片

Undresser.AI Undress
人工智慧驅(qū)動(dòng)的應(yīng)用程序,用於創(chuàng)建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費(fèi)的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費(fèi)的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強(qiáng)大的PHP整合開發(fā)環(huán)境

Dreamweaver CS6
視覺化網(wǎng)頁開發(fā)工具

SublimeText3 Mac版
神級(jí)程式碼編輯軟體(SublimeText3)

WMIC是系統(tǒng)管理員的重要工具,在「命令提示字元」下提供了高效率、精確的管理Windows系統(tǒng)的方式。管理員可利用WMIC執(zhí)行系統(tǒng)設(shè)定、查詢和監(jiān)控等操作。微軟已宣布將在未來的Windows版本中逐步淘汰WMIC:Windows1021H1:WMIC的使用者介面(UI)已不建議使用。 Windows1123H2和22H2:WMIC是作為一個(gè)「選用功能」提供,但仍預(yù)設(shè)安裝。 Windows1124H2:WMIC將完全移除。此外,從2024年1月29日起,WMIC在Windows預(yù)覽版中,僅作為一個(gè)選用功能提供

很多使用win10系統(tǒng)的小夥伴在玩遊戲或裝系統(tǒng)的時(shí)候有遇見過這個(gè)問題,應(yīng)用程式無法啟動(dòng),因?yàn)閼?yīng)用程式的並行配置不正確。有關(guān)詳細(xì)信息,請(qǐng)參閱應(yīng)用程式事件日誌,或使用命令列sxstrace.exe工具。這可能是作業(yè)系統(tǒng)沒有對(duì)應(yīng)權(quán)限的緣故,具體的教學(xué)下面一起來看看吧。使用命令列sxstrace.exe工具的教學(xué)1、該問題通常會(huì)在安裝程式、遊戲的時(shí)候出錯(cuò),其提示為:應(yīng)用程式無法啟動(dòng),因?yàn)閼?yīng)用程式的並行配置不正確。有關(guān)詳細(xì)信息,請(qǐng)參閱應(yīng)用程式事件日誌,或使用命令列sxstrace.exe工具。 2、開始→

對(duì)於不熟悉的人來說,低功耗模式會(huì)減少M(fèi)ac 的能源使用,可能會(huì)延長電池壽命,但會(huì)暫時(shí)犧牲性能,但它的處理得很好,對(duì)於大多數(shù)用戶來說,他們不會(huì)注意到任何特別的退化。如果您是 Mac 筆記型電腦用戶,並試圖從 MacBook Pro 或 Air 中獲得盡可能長的電池壽命,那麼這是一個(gè)非常有用的模式。從命令列啟用 Mac 低功耗模式從終端,在任何 Mac 筆記型電腦上鍵入以下命令字串:sudo pmset -a lowpowermode 1按 sudo 的要求按回車鍵並輸入管理員密碼進(jìn)行身份驗(yàn)證。

本文詳細(xì)介紹了將Ubuntu20.04升級(jí)到22.04的步驟。對(duì)於使用Ubuntu20.04的用戶,錯(cuò)過了22.04版本帶來的新功能和優(yōu)勢(shì)。為了獲得更好的體驗(yàn)和安全性,建議及時(shí)升級(jí)到較新的Ubuntu版本。 Ubuntu22.04的代號(hào)為“傑米水母”,讓我們一起來探索如何取得最新的LTS版本吧!如何透過命令列將Ubuntu20.04升級(jí)到22.04掌握命令列會(huì)為你帶來優(yōu)勢(shì)。雖然透過GUI更新Ubuntu是可能的,但我們的重點(diǎn)將是透過命令列。首先,讓我們使用以下命令檢查目前運(yùn)行的Ubuntu版本:$

Django專案開啟之旅:從命令列開始,創(chuàng)建你的第一個(gè)Django專案Django是一個(gè)強(qiáng)大且靈活的網(wǎng)路應(yīng)用框架,它以Python為基礎(chǔ),提供了許多開發(fā)Web應(yīng)用所需的工具和功能。本文將帶領(lǐng)你從命令列開始,創(chuàng)建你的第一個(gè)Django專案。在開始之前,請(qǐng)確保你已經(jīng)安裝了Python和Django。步驟一:建立專案目錄首先,開啟命令列窗口,並建立新的目錄

在Python中,可以透過命令列傳遞參數(shù)給腳本。這些參數(shù)可以在腳本內(nèi)部使用,以便根據(jù)不同的輸入執(zhí)行不同的操作。 Python命令列參數(shù)的詳解:1、位置參數(shù):在命令列中依照順序傳遞給腳本的參數(shù),它們可以在腳本內(nèi)部透過位置來存取;2、命令列選項(xiàng):以-或--開頭的參數(shù),通常用於指定腳本的特定選項(xiàng)或標(biāo)誌;3、傳遞參數(shù)值:透過命令列傳遞參數(shù)值。

如何透過Linux命令列工具進(jìn)行日誌聚合和統(tǒng)計(jì)?在管理和維護(hù)Linux系統(tǒng)時(shí),日誌記錄是非常重要的一項(xiàng)工作。透過日誌可以查看系統(tǒng)運(yùn)作、排查問題以及進(jìn)行效能分析。而對(duì)於大規(guī)模的系統(tǒng),日誌的數(shù)量往往非常龐大,如何有效率地對(duì)日誌進(jìn)行聚合和統(tǒng)計(jì),成為了維運(yùn)人員面臨的一個(gè)挑戰(zhàn)。在Linux系統(tǒng)中,我們可以利用命令列工具來進(jìn)行日誌聚合和統(tǒng)計(jì)。以下將介紹幾個(gè)常用的命令列

javac不是內(nèi)部或外部命令也不是可運(yùn)行的程式的解決方法: 1、首先官網(wǎng)下載JDK的最新版本並安裝;2、進(jìn)行系統(tǒng)環(huán)境變數(shù)配置,在path中添加jdk安裝的路徑;3、進(jìn)入電腦命令行介面,輸入「java -v」出現(xiàn)版本號(hào)碼即可。
