脚本-vbs-有用的脚本

脚本-vbs-有用的脚本
2010年01月15日
  ,显示系统版本
  for each ps in getobject _
  ("winmgmts:\\.\root\cimv2:win32_operatingsystem").instances_
  wscript.echo ps.caption^&" "^&ps.version:next
  cscript //nologo ps.vbs
  2,列举进程
  for each ps in getobject _
  ("winmgmts:\\.\root\cimv2:win32_process").instances_
  wscript.echo
  ps.handle^&vbtab^&ps.name^&vbtab^&ps.executablepath:next
  cscript //nologo ps.vbs
  3,终止进程
  for each ps in getobject _
  ("winmgmts:\\.\root\cimv2:win32_process").instances_
  if ps.handle=wscript.arguments(0) then wscript.echo
  ps.terminate:end if:next
  要终止PID为123的进程,使用如下语法:
  cscript pk.vbs 123
  如果显示一个0,表示终止成功。
  然后:
  del pk.vbs
  4,重启系统
  for each os in getobject _
  ("winmgmts:{(shutdown)}!
  \\.\root\cimv2:win32_operatingsystem").instances_
  os.win32shutdown(2):next >>rb.vbs & cscript //nologo rb.vbs &
  5,列举自启动的服务
  for each sc in getobject
  ("winmgmts:\\.\root\cimv2:win32_service").instances_
  if sc.startmode="Auto" then wscript.echo sc.name^&" -
  "^&sc.pathname
  next
  cscript //nologo sc.vbs
  6,列举正在运行的服务
  for each sc in getobject
  ("winmgmts:\\.\root\cimv2:win32_service").instances_
  if sc.state="Running" then wscript.echo sc.name^&" -
  "^&sc.pathname
  next
  cscript //nologo sc.vbs
  7,显示系统最后一次启动的时间
  for each os in getobject _
  ("winmgmts:\\.\root\cimv2:win32_operatingsystem").instances_
  wscript.echo os.lastbootuptime:next
  cscript //nologo bt.vbs
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值