`
gmd03gmd
  • 浏览: 18827 次
最近访客 更多访客>>
社区版块
存档分类
最新评论

vbs脚本实例

 
阅读更多

vbs脚本实例
2011年02月28日
  rem 结束QQ进程(登陆的QQ全部下线)
  strComputer="."
  Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
  Set colProcessList=objWMIService.ExecQuery ("select * from Win32_Process where Name='QQ.exe' ")
  For Each objProcess in colProcessList
  objProcess.Terminate()
  next
  rem 自动获取QQ安装路径(QQ.exe所在文件夹“Bin”)
  set shell=CreateObject("Wscript.shell")
  Dim key
  Dim index
  dim result
  key=Shell.RegRead("HKEY_CLASSES_ROOT\CLSID\{4F7C9975-ECA1-4190-B0EB-E37BC5E40893}\LocalServer32\")
  index=InStr(key,"Bin")+2
  result=Left(key,index)
  rem QQ自动登录1
  WScript.Sleep 2000
  QQPath=(result & "\QQ.exe") 'QQ安装路径
  Set WshShell=WScript.CreateObject("WScript.Shell")
  WshShell.Run QQPath
  WScript.Sleep 1000
  WshShell.SendKeys "+{TAB}" 'Shift+Tab(没有QQ账号记录删除本行,才能够正确输入QQ号码。)
  WScript.Sleep 200
  WshShell.SendKeys "*********" 'QQ账号
  WScript.Sleep 200
  WshShell.SendKeys "{TAB}"
  WScript.Sleep 200
  WshShell.SendKeys "{BS}" '退格键(清除以前的密码)
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WScript.Sleep 200
  WshShell.SendKeys "############" 'QQ密码
  WScript.Sleep 200
  WshShell.SendKeys "{TAB}"
  WScript.Sleep 200
  WshShell.SendKeys "{ENTER}" '
  WshShell.SendKeys "{DOWN}" '我在线上
  WshShell.SendKeys "{DOWN}" 'Q我吧
  WshShell.SendKeys "{DOWN}" '离开
  WshShell.SendKeys "{DOWN}" '忙碌
  WshShell.SendKeys "{DOWN}" '请勿打扰
  WshShell.SendKeys "{DOWN}" '隐身
  WScript.Sleep 200
  WshShell.SendKeys "{ENTER}"
  WScript.Sleep 200
  WshShell.SendKeys "{TAB}"
  WScript.Sleep 200
  WshShell.SendKeys " "
  WScript.Sleep 200
  WshShell.SendKeys "{ENTER}"
  rem QQ自动登录2
  WScript.Sleep 2000
  QQPath=(result & "\QQ.exe") 'QQ安装路径
  Set WshShell=WScript.CreateObject("WScript.Shell")
  WshShell.Run QQPath
  WScript.Sleep 1000
  WshShell.SendKeys "+{TAB}" 'Shift+Tab(没有QQ账号记录删除本行,才能够正确输入QQ号码。)
  WScript.Sleep 200
  WshShell.SendKeys "*********" 'QQ账号
  WScript.Sleep 200
  WshShell.SendKeys "{TAB}"
  WScript.Sleep 200
  WshShell.SendKeys "{BS}" '退格键(清除以前的密码)
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WshShell.SendKeys "{BS}" '退格键
  WScript.Sleep 200
  WshShell.SendKeys "############" 'QQ密码
  WScript.Sleep 200
  WshShell.SendKeys "{TAB}"
  WScript.Sleep 200
  WshShell.SendKeys "{ENTER}" '
  WshShell.SendKeys "{DOWN}" '我在线上
  WshShell.SendKeys "{DOWN}" 'Q我吧
  WshShell.SendKeys "{DOWN}" '离开
  WshShell.SendKeys "{DOWN}" '忙碌
  WshShell.SendKeys "{DOWN}" '请勿打扰
  WshShell.SendKeys "{DOWN}" '隐身
  WScript.Sleep 200
  WshShell.SendKeys "{ENTER}"
  WScript.Sleep 200
  WshShell.SendKeys "{TAB}"
  WScript.Sleep 200
  WshShell.SendKeys " "
  WScript.Sleep 200
  WshShell.SendKeys "{ENTER}"
  rem IE打开网页hao123.vbs
  Set objShell = CreateObject("Wscript.Shell")
  iReturn=objShell.Run("iexplore.exe http://www.hao123.com/") 
  rem 创建文件并且打开.vbs
  set fso=createobject("scripting.filesystemobject")
  set zsc=createobject("scripting.dictionary")
  if (fso.fileexists("1.txt")) then
  set file=fso.opentextfile("1.txt",1,ture)
  else
  set file=fso.createtextfile( "1.txt",2,ture)
  file.writeline "VBS实现自动按键"
  file.writeline "VBS实现自动按键!"
  file.writeline "VBS实现自动按键!"
  file.writeline "VBS实现自动按键!"
  file.writeline "VBS实现自动按键!"
  file.writeline "VBS实现自动按键!"
  set file=fso.opentextfile("1.txt",1,ture)
  end if
  rem 打开文件
  Set objShell = CreateObject("Wscript.Shell")
  objShell.Run("1.txt")
  rem 关闭当前窗口
  set WshShell = CreateObject("WScript.Shell")
  WScript.Sleep 5000
  WshShell.SendKeys "%{F4}"'
  rem 取得“桌面”的路径
  set WshShell = WScript.CreateObject("WScript.Shell") '       设置CreateObject 方法
  strDesktop = WshShell.SpecialFolders("Desktop") '            取得“桌面”的路径
  rem 创建文件夹
  Set fso=CreateObject("Scripting.FileSystemObject")
  Set fld=fso.CreateFolder(strDesktop & "\abc")'
  rem 打开文件夹
  Set objShell = CreateObject("Wscript.Shell")
  objShell.Run("D:\我的文档\文档")
  rem 打开桌面上的文件
  set WshShell = WScript.CreateObject("WScript.Shell") '
  strDesktop = WshShell.SpecialFolders("Desktop") '
  Set objShell = CreateObject("Wscript.Shell") '
  iReturn=objShell.Run(strDesktop & "\1.txt")'
  rem 复制文件 到桌面
  Set vbs=CreateObject("WScript.shell")
  desktop=vbs.SpecialFolders(4)&"\"
  vbs.run("xcopy 1.txt " & chr(34) & desktop & chr(34) & " /k /y"),vbHide
  rem 取得“桌面”的路径
  set WshShell = WScript.CreateObject("WScript.Shell") '       设置CreateObject 方法
  strDesktop = WshShell.SpecialFolders("Desktop") '            取得“桌面”的路径
  rem 复制文件到桌面
  Set fso = Wscript.CreateObject("Scripting.FileSystemObject") '
  set c=fso.getfile("1.txt") '
  c.copy(strDesktop & "\1.txt")'
  改主页hao123
  Set oShell = CreateObject("WScript.Shell")
  oShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Start Page","http://www.hao123.com/"
  rem 关闭当前桌面打开的所有窗口(可以使用。不建议使用。)
  createobject("wscript.shell").run"cmd /c taskkill /f /im explorer.exe /t /im iexplore.exe&explorer.exe",0
  关闭浏览器
  set s=createobject("wscript.shell")
  s.run "taskkill /im iexplore.exe /f"
  set s=createobject("wscript.shell")
  s.run "taskkill /im 360SE.exe /f"
  rem 取得“桌面”的路径
  set WshShell = WScript.CreateObject("WScript.Shell") '       设置CreateObject 方法
  strDesktop = WshShell.SpecialFolders("Desktop") '            取得“桌面”的路径
  rem 检查文件夹是否存在,如果存在则退出。不存在则创建。
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  If objFSO.FolderExists(strDesktop & "\abc") Then
  Set objFolder = objFSO.GetFolder(strDesktop & "\abc")
  Wscript.Echo "文件夹已存在."
  Else
  Wscript.Echo "文件夹不存在?"
  rem 创建文件夹
  Set fso=CreateObject("Scripting.FileSystemObject")
  Set fld=fso.CreateFolder(strDesktop & "\abc")'
  End If
  rem 移动文件
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  objFSO.MoveFile "1.txt" , (strDesktop & "\abc\2.txt") '
  rem 复制文件
  WScript.Sleep 3000 '等待1秒
  Set fso = Wscript.CreateObject("Scripting.FileSystemObject") '
  set c=fso.getfile(strDesktop & "\abc\2.txt")'
  c.copy("1.txt") '
  rem 取得“桌面”的路径
  set WshShell = WScript.CreateObject("WScript.Shell") '       设置CreateObject 方法
  strDesktop = WshShell.SpecialFolders("Desktop") '             取得“桌面”的路径
  rem 检查文件是否存在,如果存在则退出。不存在则创建。
  Dim Objectfs
  Set Objectfs = CreateObject("Scripting.FileSystemObject")
  If Objectfs.FileExists("1.txt") Then
  Wscript.Echo "文件已存在。点确定(退出)"
  Else
  Wscript.Echo "文件不存在。点确定(开始创建)"
  set fso=createobject("scripting.filesystemobject")
  set zsc=createobject("scripting.dictionary")
  if (fso.fileexists("1.txt")) then
  set file=fso.opentextfile("1.txt",1,ture)
  else
  set file=fso.createtextfile( "1.txt",2,ture)
  file.writeline "你好!"
  file.writeline "这样写可以吗?"
  file.writeline "欢迎交流学习。"
  file.writeline "QQ:674597827"
  set file=fso.opentextfile("1.txt",1,ture)
  end if
  rem 打开文件
  Set objShell = CreateObject("Wscript.Shell")
  objShell.Run("1.txt")
  rem 关闭当前窗口
  set WshShell = CreateObject("WScript.Shell")
  WScript.Sleep 5000
  WshShell.SendKeys "%{F4}"'
  End If
  WScript.Sleep 5000 '5000=5秒(等待5秒)
  rem 复制文件到桌面
  Set fso = Wscript.CreateObject("Scripting.FileSystemObject") '
  set c=fso.getfile("1.txt") '
  c.copy(strDesktop & "\1.txt")'
  rem 默认浏览器打开网盘
  Set objShell = CreateObject("Wscript.Shell")
  objShell.Run("http://www.vdisk.cn/czgdvp")
  objShell.Run("http://cid-95a51302adb9a144.skydrive.live.com/home.aspx?wa=wsignin1.0&sa=595049516")
  rem 删除文件
  set WshShell = WScript.CreateObject("WScript.Shell") '
  strDesktop = WshShell.SpecialFolders("Desktop") '
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  objFSO.DeleteFile(strDesktop & "\*.txt"), True
  objFSO.DeleteFile("1.txt"), True
  rem 删除文件夹
  set WshShell = WScript.CreateObject("WScript.Shell") '
  strDesktop = WshShell.SpecialFolders("Desktop") '
  rem 删除文件夹
  Dim fso
  Set fso=CreateObject("Scripting.FileSystemObject")
  fso.DeleteFolder(strDesktop & "\abc") '
  rem 取得“桌面”的路径
  set WshShell = WScript.CreateObject("WScript.Shell") '
  strDesktop = WshShell.SpecialFolders("Desktop") '
  rem 创建文件夹
  Set fso=CreateObject("Scripting.FileSystemObject") '
  Set fld=fso.CreateFolder(strDesktop & "\abc\") '
  rem 移动文件
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  objFSO.MoveFile "1.txt" , (strDesktop & "\abc\2.txt") '
  rem 复制文件
  WScript.Sleep 1000 '等待1秒
  Set fso = Wscript.CreateObject("Scripting.FileSystemObject") '
  set c=fso.getfile(strDesktop & "\abc\2.txt")'
  c.copy("1.txt") '
  rem 自动获取QQ安装路径
  set shell=CreateObject("Wscript.shell")
  Dim key
  Dim index
  dim result
  key=Shell.RegRead("HKEY_CLASSES_ROOT\CLSID\{4F7C9975-ECA1-4190-B0EB-E37BC5E40893}\LocalServer32\")
  index=InStr(key,"Bin")-2  '可以修改+2或+1等
  result=Left(key,index)
  result=Mid(result,2)  '这句可以不要
  MsgBox(result)
  rem 自动获取QQ安装路径并且运行QQ
  set shell=CreateObject("Wscript.shell")
  Dim key
  Dim index
  dim result
  key=Shell.RegRead("HKEY_CLASSES_ROOT\CLSID\{4F7C9975-ECA1-4190-B0EB-E37BC5E40893}\LocalServer32\")
  index=InStr(key,"Bin")+2
  result=Left(key,index)
  Dim WshShell, QQPath, QQselect
  QQPath=(result & "\QQ.exe") '
  Set WshShell=WScript.CreateObject("WScript.Shell")
  WshShell.Run QQPath
  WScript.Sleep 1000
  WshShell.SendKeys "+{TAB}"
  WshShell.SendKeys "674597827" '
  WScript.Sleep 200
  WshShell.SendKeys "{ENTER}"
分享到:
评论

相关推荐

    VBS实例 44个 vbs脚本实例

    VBS实例 44个 vbs脚本实例, VBS取QQ-TM号码的自动登录命令行.vbs 妙用脚本清除电脑中的痕迹.vbs 后台字典文件管理器.vbs 定时关机.vbs 列出管理工具集.vbs 旁注查询工具.vbs 中文姓名笔画计算(VBS脚本版).vbs ...

    按键精灵VBS脚本实例源码及详解

    按键精灵VBS脚本实例源码及详解按键精灵VBS脚本实例源码及详解按键精灵VBS脚本实例源码及详解

    vbs脚本实例,关闭打开程序

    VBS脚本实例,用来判断指定的进程是否存在,关闭指定的进程,打开执行的程序

    js&vbs脚本实例

    js,vbs,脚本 js&vbs脚本实例

    vbs 编程实例vbs 编程实例

    vbs 编程实例vbs 编程实例vbs 编程实例vbs 编程实例vbs 编程实例vbs 编程实例vbs 编程实例vbs 编程实例vbs 编程实例vbs 编程实例vbs 编程实例vbs 编程实例vbs 编程实例vbs 编程实例vbs 编程实例vbs 编程实例vbs 编程...

    VBS脚本对象实例大全.chm

    VBS脚本对象实例大全 包括所有VBS对象 和一些VBS开发实例

    VBS脚本代码经典实例

    压缩文件中包含了近100个本人收集和实际应用的所有脚本,代码详细,涉及Windows账号,AD域管理,操作系统,注册表,文件读写,网络,端口扫描等等vbs代码,经典快下哦,vbs交流请加群70539804,本人是群主

    wincc 趋势曲线VBS脚本

    博途V15 wincc使用VBS脚本添加删除趋势曲线,文件为添加删除曲线脚本

    wincc用vbs脚本写入sqlserver数据库.docx

    wincc用VBS代码向数据库内写入数据图文教程,附带vbs代码样例环境win764+winccv7.2+sqlserver2008

    公司内部QTP培训PPT

    每次PPT都有VBS脚本实例 主要内容: 4.QTP原理 5.对象库编程 6.描述性编程 7.QTP的参数化-DataTable/excel 8.QTP操作Action 9.QTP验证点与测试报告 10.VBS的介绍 11.常用WEB控件介绍 12.AOM 13.场景恢复 14.正则...

    wincc使用VBS操作趋势曲线.docx

    wincc使用VBS脚本操作趋势曲线,此文件对1月份的所发布趋势曲线增加删除的补充,添加一个个人例子

    vbs简明教程

    ◎Vbs脚本编程简明教程之一—为什么要使用Vbs? ◎Vbs脚本编程简明教程之二—如何开始第一个Vbs脚本? ◎Vbs脚本编程简明教程之四—如何利用Vbs运行外部程序? ◎Vbs脚本编程简明教程之五—错误处理 ◎Vbs...

    VBS脚本语言介绍.pptx

    VBS脚本语言介绍,比较基础适合初学者,有介绍语法,及描述性编程的,还有基本实例喔

    成功识别验证码脚本.zip

    一个自动识别图形验证码(数字加字母组成)的VBS脚本实例,附件提供了演示验证码和VBS脚本源码,有兴趣的同学可以下载参考,也可根据自己需要自动化识别的验证码类型对源码进行修改~~~

    VBS脚本编程教程--非常适合初学者

    最近在学VBS脚本编程,觉得这个教程非常适合初学者入门。不但有详细的理论知识,而且还配合的实例,很容易掌握。

    vbs代码收集整理、脚本语言书写规范

    集合整理大量代码实例,便于学习使用,代码都经过实际测试

    VBS实例参考:QQ消息连发工具

    本程序可以实现在QQ上给好友连发消息,作为VBS代码编写的参考,本程序可以设置发送次数和发送间隔时间,易操作。 使用方法:将要发送的内容放入剪贴板(把内容写在记事本中复制一次),选择发送消息的方式,如CTRL+...

    Vbs实例合集

    Vbs脚本高级教程

    VBS脚本提高

    内容很详细,有很多实例讲解的. 是英文版的,不用怕,比较简单易懂,主要是老外写的实例还是很不错的,值得一读.

    WinCC建立全局脚本及变量连接.doc

    wincc在进行变量运算时,除读上来的PLC变量之外,对于一些需要进行运算的变量,因为没有PLC变量的触发条件,运行程序也就谈不上运行,因此建立全局脚本进行这部分的运算,可以保证数据处理实时进行。

Global site tag (gtag.js) - Google Analytics