wmic应用实例
实例应用
1、磁盘管理
查看磁盘的属性
wmic logicaldisk list brief
::caption=标题、driveID=驱动器ID号、model=产品型号、Partitions=分区、size=大小
根据磁盘的类型查看相关属性
wmic logicaldisk where drivetype=3 list brief
使用get参数来获得自己想要参看的属性
wmic logicaldisk where drivetype=3 get deviceid,size,freespace,description,filesystem
只显示c盘的相关信息
wmic logicaldisk where name="c:" get deviceid,size,freespace,description,filesystem
::description=描述、deviceid=驱动器ID号、size=大小、freespace=剩余空间、filesystem=文件系统
更改卷标的名称
wmic logicaldisk where name="c:" set volumename=lsxq
获得U盘的盘符号
wmic logicaldisk where drivetype='2' get deviceid,description
wmic logicaldisk where "drivetype=2" get name
::2=移动磁盘、3=本地磁盘、5=光驱。
查看物理磁盘的真实情况
wmic diskdrive list brief
查看物理磁盘的真实情况
wmic diskdrive list
2、系统服务管理
获得指定服务进程的PID号
wmic service where name="TermService" get processid
显示正在运行的服务
wmic service where state='running' get name,displayname
显示已启动服务对应所在的可执行文件路径
wmic service where state='running' get name,pathname
启动一个服务
wmic service where name="sharedaccess" startservice
停止一个服务
wmic service where name="sharedaccess" stopservice
将某个服务设为自启动(手动、禁用)
wmic service where name='sharedaccess' changestartmode 'automatic'
显示开机自启动的服务
wmic service where startmode='auto' get name,displayname
显示开始自启动并且当前处于运行状态的服务
wmic service where "startmode='auto' and state='running'" get name,displayname
显示禁用或手动启动的服务
wmic service where 'startmode="disabled" or startmode="manual"' get name,displayname
3、进程管理
结束一个进程(可根据进程对应的PID)
wmic process where name="notepad.exe" delete
wmic process where name="notepad.exe" terminate
wmic process where pid="123" delete
wmic path win32_process where "name='notepad.exe'" delete
创建一个进程
wmic process call create "c:\windows\system32\calc.exe"
查询进程的启动路径(将得到的信息输出)
wmic process get name,executablepath,processid
wmic /output:c:\process.html process get processid,name,executablepath /format:htable.xsl
查询指定进程的信息
wmic process where name="notepad.exe" get name,executablepath,processid
在远程计算上创建进程
wmic /node:192.168.8.10 /user:administrator /password:xiongyefeng process call create "c:\windows\notepad.exe"
查询远程计算机上的进程列表
wmic /node:192.168.8.10 /user:administrator /password:xiongyefeng process get name,executablepath,processid
将获得到的远程计算机进程列表保存到本地
wmic /output:c:\process.html /node:192.168.8.10 /user:administrator /password:xiongyefeng process get processid,name,executablepath /format:htable.xsl
结束远程计算上的指定进程
wmic /node:192.168.8.10 /user:administrator /password:xiongyefeng process where name="notepad.exe" delete
重启远程计算机
wmic /node:192.168.8.10 /user:administrator /password:xiongyefeng process call create "shutdown -r -f"
关闭远程计算机
wmic /node:192.168.8.10 /user:administrator /password:xiongyefeng process call create "shutdown -s -f"
高级应用:
结束可疑的进程
wmic process where "name='explorer.exe' and executablepath <> '%systemdrive%\\windows\\explorer.exe'" delete
wmic process where "name='svchost.exe' and executablepath <> '%systemdrive%\\windows\\system32\\svchost.exe'" call terminate
4、文件管理
更改文件名
wmic datafile "c:\\test.txt" rename "c:\lsxq.txt"
复制单个文件
wmic datafile "c:\\test.txt" copy "d:\lsxq.txt"
获得指定路径下特定扩展名的文件列表
wmic datafile where "drive='c:' and path='\\' and extension='txt'" get name,Path,"System File"
删除文件夹
wmic fsdir "c:\\test" delete
文件夹重命名
wmic fsdir "c:\\test" rename "c:\lsxq"
复制文件夹
wmic fsdir "c:\test" copy "d:\test"
全盘查找指定文件
wmic datafile where "filename='qq' and extension='exe'" get name
获得指定路径下特定扩展名并要求只显示满足题目条件的文件
wmic datafile where "drive='e:' and path='\\surecity\\' and extension='rar' and filesize>1000" get name
获取文件的创建、访问、修改时间
Wmic datafile where name="c:\\windows\\notepad.exe" get CreationDate,LastAccessed,LastModified
二、wmic技术代码:
查询远程计算机上的进程列表
wmic /node:192.168.8.10 /user:administrator /password:xiongyefeng process get name,executablepath,processid
将获得到的远程计算机进程列表保存到本地
wmic /output:c:\process.html /node:192.168.8.10 /user:administrator /password:xiongyefeng process get processid,name,executablepath /format:htable.xsl
结束远程计算上的指定进程
wmic /node:192.168.8.10 /user:administrator /password:xiongyefeng process where name="notepad.exe" delete
重启远程计算机
wmic /node:192.168.8.10 /user:administrator /password:xiongyefeng process call create "shutdown -r -f"
关闭远程计算机
wmic /node:192.168.8.10 /user:administrator /password:xiongyefeng process call create "shutdown -s -f"
wmic应用实例的更多相关文章
- 最近学习工作流 推荐一个activiti 的教程文档
全文地址:http://www.mossle.com/docs/activiti/ Activiti 5.15 用户手册 Table of Contents 1. 简介 协议 下载 源码 必要的软件 ...
- Windows WMIC命令使用详解(附实例)
第一次执行WMIC命令时,Windows首先要安装WMIC,然后显示出WMIC的命令行提示符.在WMIC命令行提示符上,命令以交互的方式执行 执行“wmic”命令启动WMIC命令行环境.这个命令可以在 ...
- [No000013A]Windows WMIC命令使用详解(附实例)
第一次执行WMIC命令时,Windows首先要安装WMIC,然后显示出WMIC的命令行提示符.在WMIC命令行提示符上,命令以交互的方式执行 执行“wmic”命令启动WMIC命令行环境.这个命令可以在 ...
- (转载)Windows WMIC命令使用详解(附实例)
原文地址:http://www.jb51.net/article/49987.htm 第一次执行WMIC命令时,Windows首先要安装WMIC,然后显示出WMIC的命令行提示符.在WMIC命令行提示 ...
- 比CMD更强大的命令行WMIC
先决条件:a. 启动Windows Management Instrumentation服务,开放TCP135端口.b. 本地安全策略的“网络访问: 本地帐户的共享和安全模式”应设为“经典-本地用户以 ...
- Windows WMIC命令使用详解
本文转载出处http://www.jb51.net/article/49987.htm www.makaidong.com/博客园文/32743.shtml wmic alias list brief ...
- 本地服务器硬件信息获取指令wmic
获取BIOS序列号 wmic bios list full | find "SerialNumber" SerialNumber=P50168VB 获取CPUID(WIN32_PR ...
- [Windows]查看运行进程的参数【wmic】
参考 https://www.cnblogs.com/top5/p/3143827.html 和 https://blog.csdn.net/swazer_z/article/details ...
- windows下wmic命令
转载 https://www.cnblogs.com/archoncap/p/5400769.html 第一次执行WMIC命令时,Windows首先要安装WMIC,然后显示出WMIC的命令行提示符.在 ...
随机推荐
- ip地址分类和网段区分
IP地址分类/IP地址10开头和172开头和192开头的区别/判断是否同一网段 简单来说在公司或企业内部看到的就基本都是内网IP,ABC三类IP地址里的常见IP段. 每个IP地址都包含两部分,即网络号 ...
- Struts2拦截器配置
1. 理解拦截器 1.1. 什么是拦截器: 拦截器,在AOP(Aspect-Oriented Programming)中用于在某个方法或字段被访问之前,进行拦截然后在之前或之后加入某些操作.拦截是AO ...
- 【转】母函数(Generating function)详解 — TankyWoo(红色字体为批注)
母函数(Generating function)详解 - Tanky Woo 在数学中,某个序列的母函数(Generating function,又称生成函数)是一种形式幂级数,其每一项的系数可以提供 ...
- 如何在Sublime Text中添加代码片段
我们在编写代码的时候,总会遇到一些需要反复使用的代码片段.这时候就需要反复的复制和黏贴,大大影响效率.我们利用Sublime Text的snippet(代码片段)功能,就能很好的解决这一问题.通俗的讲 ...
- UEFI安装Win10
启动方式: Legency UEFI 分区表类型: MBR 主引导记录 最多4个主分区 最大支持2.1T硬盘 GPT 基于可扩展固件接口(EFI) 分区数不限 NTFS格式最大支持256T硬盘 安装模 ...
- intellij idea 12 搭建maven web项目
原来公司一直使用eclipse,突然使用这个intellij还真有点不习惯,等用了一段时间才发现的确好用,因为也是刚开始用,所以很多不理解的地方,搭建一个项目从头好好了解下intellij 最开始的m ...
- TortoiseGit HTTPS方式保存密码最简单的方法
在TortoiseGit的设置 -> git 中选择 编辑本地 .git/config 在最后增加下面内容: [credential] helper = store
- Application.DoEvents()的作用
记得第一次使用Application.DoEvents()是为了在加载大量数据时能够有一个数据加载的提示,不至于系统出现假死的现象,当时也没有深入的去研究他的原理是怎样的,结果在很多地方都用上了App ...
- PAT 乙级 1004. 成绩排名
读入n名学生的姓名.学号.成绩,分别输出成绩最高和成绩最低学生的姓名和学号. 输入格式:每个测试输入包含1个测试用例,格式为 第1行:正整数n 第2行:第1个学生的姓名 学号 成绩 第3行:第2个学生 ...
- JS复习:第二十三章
一.Cookie的构成: 1.名称:一个唯一确定cookie的名称.cookie名称不区分大小写,必须是经过URL编码的. 2.值:存储在cookie中的字符串值,必须被URL编码. 3.域:cook ...