1. 程式人生 > >windows系統下通過cmd命令查詢某個程序的執行路徑

windows系統下通過cmd命令查詢某個程序的執行路徑

我們常常需要知道執行的程序在哪個目錄下。使用wmic非常方便,能夠知道程序的詳細資訊。

例如:工作管理員中顯示的程序名為c.exe.

查詢路徑方法是:開啟cmd.exe,輸入wmic ,然後輸入process where(Description="c.exe")

wmic 作用總結:

一、查詢資料

1 使用get查詢

wmic process get name,executablepath

2 無條件查詢

wmic process list brief

wmic process list full

3加where條件查詢

wmic process where name="qq.exe" get processid,executablepath,name

會顯示所有的同名程序,注意where條件在前面,要獲取的屬性在後面。

二、建立程序

wmic process call create  "c:\windows\system32\cmd.exe"

三、結束程序

wmic process where name="qq.exe" call terminate

wmic process where name="qq.exe" delete

轉載自:http://blog.csdn.net/cfanzp/article/details/8825130