WMIC常用命令整理

2021-06-26 21:16:32 字數 3925 閱讀 3644



前沿:wmic命令在我們的工作中可以幫助我們減少對其他工具的依賴並節省我們的時間,實在是乙個值得學習和研究的好東西

命令很多,這裡我把網上目前能找到的較實用的一些命令整理出來,希望各位看官能找到自己需要的東西

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

獲得系統版本資訊

wmic datafile where name='c://windows' get manufacturer,version,filename

獲得系統程序

wmic process list full        注意:

這裡的full也可以換成brief(簡潔)

獲得硬體資訊(這裡以cpu為例)

wmic cpu get name,caption,maxclockspeed,description

將結果輸出到d盤的1.txt裡面

wmic /output:d:/1.txt cpu get name

wmic 獲取硬碟固定分割槽碟符:

wmic logicaldisk where "drivetype=3" get name

wmic 獲取硬碟各分割槽檔案系統以及可用空間:

wmic logicaldisk where "drivetype=3" get name,filesystem,freespace

wmic 獲取程序名稱以及可執行路徑:

wmic process get name,executablepath

wmic 刪除指定程序(根據程序名稱):

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

或者用wmic process where name="qq.exe" delete

wmic 刪除指定程序(根據程序pid):

wmic process where pid="123" delete

wmic 建立新程序

在遠端機器上建立新程序:

wmic /node:192.168.1.10 /user:administrator /password:123456 process call create cmd.exe

關閉本地計算機

wmic process call create shutdown.exe

重啟遠端計算機

wmic /node:192.168.1.10/user:administrator /password:123456 process call create "shutdown.exe -r -f -m"

更改計算機名稱

wmic computersystem where "caption='%computername%'" call rename newcomputername

更改帳戶名

wmic useraccount where "name='%username%'" call rename newusername

wmic 結束可疑程序(根據程序的啟動路徑)

wmic process where "name='explorer.exe' and executablepath<>'%systemdrive%//windows'" delete

wmic 獲取物理記憶體

wmic memlogical get totalphysicalmemory|find /i /v "t"

wmic 獲取檔案的建立、訪問、修改時間

@echo off

'wmic datafile where name^="c://windows//system32" get creationdate^,lastaccessed^,lastmodified

wmic 全盤搜尋某檔案並獲取該檔案所在目錄

wmic datafile where "filename='qq' and extension='exe'" get drive,path

for /f "skip=1 tokens=1*" %i in ('wmic datafile where "filename='qq' and extension='exe'" get drive^,path') do (set "qpath=%i%j"

&@echo %qpath:~0,-3%)

獲取螢幕解析度

wmic desktopmonitor where status='ok' get screenheight,screenwidth

獲取共享資源(包括隱藏共享)

wmic share list brief

獲取u盤碟符,並執行u盤上的qq.exe

@for /f "skip=1 tokens=*" %i in ('wmic logicaldisk where "drivetype=2" get name') do (if not "%i"=="" start d:/qq.exe)

獲得程序當前占用的記憶體和最大占用記憶體的大小:

wmic process where caption='filename.exe' get workingsetsize,peakworkingsetsize

更改現有工作組為指定的工作組

wmic computersystem where "name='計算機名稱' call unjoindomainorworkgroup

退出所在域

wmic computersystem where "name='計算機名稱'" call joindomainorworkgroup "",1,"網域名稱稱","域管理員密碼","域管理員使用者名稱"

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

開2003的3389

wmic rdtoggle where servername='%computername%' call

setallowtsconnections 1

遠端開啟計算機遠端桌面

wmic /node:%pcname% /user:%pcaccount% path win32_terminalservicesetting where (__class!="") call setallowtsconnections 1

新增的計畫任務,wmic新增的同樣at命令也是可以看到

wmic job call create "sol.exe",0,0,true,false,********154800.000000+480

wmic job call create "sol.exe",0,0,1,0,********154600.000000+480

這兩句是相同的,true可以用1表示,同樣的false可以用0值表示,時間前為何用八個星號,這是wmic的特性,他顯示時間的方式是yyyymmddhhmmss.mmmmmm+時區 ,可是,我們並不需要指定年份和月份還有天,所以用*星號來替代

在wmic下檢視bios資訊

wmic bios list full

wmic還有停止、暫停和執行服務的功能:

啟動服務startservice,停止服務stopservice,暫停服務pauseservice。

具體的命令使用格式就是:

wmic service where caption=」windows time」 call stopservice

●--停止服務

wmic service where caption=」windows time」 call startservice

●--啟動服務

wmic service where name=」w32time」 call stopservice

●--停止服務,注意name和caption的區別。

遠端建立程序

wmic /node:109.254.2.102 /user:"rdgad/administrator" /password:"1234" process call create commandline="cmd.exe /k echo ***xx|clip.exe"

VI常用命令整理

1 複製多行,並貼上1 將游標定位於想開始複製的行,然後輸入想要複製的行數 如 3,然後輸入yy 2 定位到需要貼上到的前一行,輸入p 2 刪除多行1 將游標定位於想要開始刪除的行,然後輸入想要刪除的行數 如 3,然後輸入dd 說明 其實這個操作是剪下操作,如果需要將剛才刪除的行貼上到另外乙個地方,...

整理CentOS常用命令

在電腦常用操作中,我們經常會用到centos常用命令。所以,我們對一些經常使用又很重要的centos常用命令進行了全面的整理。下面,就給大家介紹這些centos常用命令。一 使用centos常用命令檢視cpu more proc cpuinfo grep model name grep model ...

Linux 常用命令整理

在linux 下開發兩年了,目前轉向windows平台開發。將一些在linux 下經常會用到的命令進行整理,以免長時間不用忘了。1.使用ldd命令檢視hello依賴於哪些庫 ldd hello libc.so.6 lib libc.so.6 0x400la000 lib ld linux.so.2 ...