1格式化文件,特别是xsl格式,这个我没试过,大家有兴趣可以试试,
wmic /output:c:\process.html process list /format:htable.xsl
2进程管理
#列出进程的核心信息,有点像任务管理器 wmic process list brief #新建calc进程 wmic process call create calc #列出进程的信息,这个命令可以借助管道就可以找到你想要的进程启动参数,如 | find "tomcat" wmic process get caption,handle,commandline,executablepath #结束进程 handle是文件句柄,接触过c++变成的比较了解 wmic process [handle/PID] delete wmic process [handle/PID] call terminate
3 bios管理
wmic bios get name,SMBIOSBIOSVersion,manufacturer
4 系统管理
#查看硬件、操作系统基本信息 wmic computersystem get Name,workgroup,NumberOfProcessors,manufacturer,Model #查看系统启动选项boot.ini的内容 wmic computersystem get SystemStartupOptions #查看工作组/域 wmic computersystem get domain #更改计算机名abc为123 wmic computersystem where "name='nonobaba'" call rename skyhits #更改工作组google为MyGroup wmic computersystem where "name='wodsy'" call joindomainorworkgroup "","","MyGroup",1
5 文件管理
#查找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
6系统管理
#获取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% wmic ENVIRONMENT create name="home",username="<system>",VariableValue="%HOMEDRIVE%%HOMEPATH%" #删除home环境变量 wmic ENVIRONMENT where "name='home'" delete
wmic的命令基本用不到,所以就不介绍了,有兴趣大家百度一下wmic查看他的详细用法。