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

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

ReadOperationCount=85656
ReadTransferCount=121015982
SessionId=0
Status=
TerminationDate=
ThreadCount=57
UserModeTime=1778750000
VirtualSize=353206272
WindowsVersion=5.1.2600
WorkingSetSize=93716480
WriteOperationCount=30940
WriteTransferCount=24169673
******************************************************************************
停止、暂停和运行服务功能
启动服务startservice,
停止服务stopservice,
暂停服务pauseservice
Service where caption="windows time" call stopservice ------停止服务
Service where caption="windows time" call startservice ------启动服务
Service where name="w32time" call stopservice          ------停止服务,注意name和caption的区别。
caption 显示服务名name服务名称,如: telnet服务的显示名称是telnet 服务名称是tlntsvr,还有Windows Time服务的名称是w32time 显示名称是"Windows Time"要用引号引起来,主要是有一个空格。
好了具体看一下:输入Service where caption="windows time" call startservice后有一个确认输入y就可以了,返回ReturnValue = 0;表示成功
wmic:rootcli>Service where caption="windows time" call startservice
执行 (CHINA-46B1E8590ROOTCIMV2:Win32_Service.Name="W32Time")->startservice()
方法执行成功。
输出参数:
instance of __PARAMETERS
{
        ReturnValue = 0;
};

wmic:rootcli>
================================================================================================
显示出BIOS信息 wmic bios list full
大家可能注意到了上面命令行中还有两个参数list和full。list决定显示的信息格式与范围,它有Brief、Full、Instance、 Status、System、Writeable等多个参数,full只是它的一个参数,也是list的缺省参数,表示显示所有的信息。其他几个参数顾名思义,如Brief表示只显示摘要信息,Instance表示只显示对象实例,Status表示显示对象状态,Writeable表示只显示该对象的可写入的属性信息等。

************************************************************************=====================
停止进程的操作
例如,执行下面的命令将关闭正在运行的QQ.exe:
例1、wmic process where name='QQ.exe' call terminate
命令运行结束后,WMIC命令行提示出如下结果:
C:>wmic process where name='QQ.exe' call terminate
执行 (CHINA-46B1E8590ROOTCIMV2:Win32_Process.Handle="728")->terminate()
方法执行成功。
输出参数:
instance of __PARAMETERS
{
        ReturnValue = 0;
};

例2、wmic process where name="qq.exe" delete
命令运行结束后,WMIC命令行提示出如下结果:

C:>wmic process where name="qq.exe" delete
删除范例 CHINA-46B1E8590ROOTCIMV2:Win32_Process.Handle="2820"
范例删除成功。
======================================================================

相关文章 大家在看