Chinaunix首页 | 论坛 | 博客
  • 博客访问: 551901
  • 博文数量: 48
  • 博客积分: 1371
  • 博客等级: 中尉
  • 技术积分: 587
  • 用 户 组: 普通用户
  • 注册时间: 2011-10-04 15:32
文章分类

全部博文(48)

文章存档

2013年(5)

2012年(35)

2011年(8)

分类: WINDOWS

2012-12-09 18:38:46

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 process call create "C:\Program Files\Tencent\QQ\QQ.exe" 

在远程机器上创建新进程: 
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\\explorer.exe'" delete 

wmic 获取物理内存 
wmic memlogical get TotalPhysicalMemory|find /i /v "t" 

wmic 获取文件的创建、访问、修改时间 

@echo off 
'wmic datafile where name^="c:\\windows\\system32\\notepad.exe" 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 

获取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 
把内存大小改成KB(MB的话可能有小数) 
@echo off 
for /f "skip=1 tokens=1-2 delims= " %%a in ('wmic process where caption^="conime.exe" get WorkingSetSize^,PeakWorkingSetSize') do ( 
set /a m=%%a/1024 
set /a mm=%%b/1024 
echo 进程conime.exe现在占用内存:%m%K;最高占用内存:%mm%K 

pause
阅读(4019) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~