Windows WMIC命令使用详解(附实例)

2019-09-19 06:44:54丽君

列出所有的进程   wmic process
==================================================================

连接远程电脑

★★连接远程的电脑,不过好象对要开一些相应的服务

wmic /node:"192.168.203.131" /password:"" /user:"administrator"

BIOS - 基本输入/输出服务 (BIOS) 管理
★★查看bios版本型号
wmic bios get Manufacturer,Name

WMIC设置IP地址
★★配置或更新IP地址:
wmic nicconfig where index=0 call enablestatic("192.168.1.5"), ("255.255.255.0") ;index=0说明是配置网络接口1。
配置网关(默认路由):
wmic nicconfig where index=0 call setgateways("192.168.1.1"),(1)

COMPUTERSYSTEM - 计算机系统管理
★★查看系统启动选项,boot的内容
wmic COMPUTERSYSTEM get SystemStartupOptions
★★查看工作组/域
wmic computersystem get domain
★★更改计算机名abc为123
wmic computersystem where "name='abc'" call rename 123
★★更改工作组google为MyGroup
wmic computersystem where "name='google'" call joindomainorworkgroup "","","MyGroup",1

CPU - CPU 管理
★★查看cpu型号
wmic cpu get name

DATAFILE - DataFile 管理
★★查找e盘下test目录(不包括子目录)下的cc.cmd文件
wmic datafile where "drive='e:' and path='test' and FileName='cc' and Extension='cmd'" list
★★查找e盘下所有目录和子目录下的cc.cmd文件,且文件大小大于1K
wmic datafile where "drive='e:' and FileName='cc' and Extension='cmd' and FileSize>'1000'" list
★★删除e盘下文件大小大于10M的.cmd文件
wmic datafile where "drive='e:' and Extension='cmd' and FileSize>'10000000'" call delete
★★删除e盘下test目录(不包括子目录)下的非.cmd文件
wmic datafile where "drive='e:' and Extension<>'cmd' and path='test'" call delete
★★复制e盘下test目录(不包括子目录)下的cc.cmd文件到e:,并改名为aa.bat
wmic datafile where "drive='e:' and path='test' and FileName='cc' and Extension='cmd'" call copy "e:aa.bat"
★★改名c:hello.txt为c:test.txt
wmic datafile "c:hello.txt" call rename c:test.txt
★★查找h盘下目录含有test,文件名含有perl,后缀为txt的文件
wmic datafile where "drive='h:' and extension='txt' and path like '%test%' and filename like '%perl%'" get name

DESKTOPMONITOR - 监视器管理
★★获取屏幕分辨率
wmic DESKTOPMONITOR where Status='ok' get ScreenHeight,ScreenWidth

DISKDRIVE - 物理磁盘驱动器管理
★★获取物理磁盘型号大小等
wmic DISKDRIVE get Caption,size,InterfaceType

ENVIRONMENT - 系统环境设置管理
★★获取temp环境变量
wmic ENVIRONMENT where "name='temp'" get UserName,VariableValue
★★更改path环境变量值,新增e:tools
wmic ENVIRONMENT where "name='path' and username='<system>'" set VariableValue="%path%;e:tools"
★★新增系统环境变量home,值为%HOMEDRIVE%%HOMEPATH%

相关文章 大家在看