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

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脚本实例源码及详解 #### 1. 基本例子介绍 在本文档中,我们将详细探讨一个按键精灵VBS脚本的具体实现细节,该脚本主要用于《QQ幻想世界》游戏中的自动打怪功能。通过分析此脚本,我们可以了解如何...

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

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

    按键精灵VBS经典脚本教程

    四、VBS脚本实例 1. 文件下载(无回显)脚本: 使用VBS脚本可以实现文件下载,并且不显示下载过程。 2. 列举进程脚本: 使用VBS脚本可以列举系统中的进程。 3. 终止进程脚本: 使用VBS脚本可以终止系统中的...

    js&vbs脚本实例

    JavaScript(简称JS)和Visual Basic Script(简称VBScript)是两种不同的脚本语言,它们在Web开发和其他系统自动化中有着广泛的应用。以下是关于这两种脚本语言的一些关键知识点: 1. JavaScript: - JavaScript...

    好玩的VBS整人脚本

    "哈哈.vbs"和"爱情测试.vbs"是具体的VBS脚本实例,名字暗示了它们可能带有娱乐性质。"哈哈.vbs"可能是一个触发搞笑事件的脚本,而"爱情测试.vbs"可能是一个模拟情感测试的程序,但结果可能是出乎意料的恶搞。 "解除...

    VBS脚本对象实例大全.chm

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

    VBS脚本代码经典实例

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

    VBS脚本开发工具

    5. "VBS实例":这是一个包含VBS脚本示例的文件夹,通过这些实例,开发者可以直接学习到VBS的实际应用和编程技巧。 6. "3SOFT"、"VbsCript"、"VBSClass":这些可能是额外的工具、库或者教程资料,比如3SOFT可能是一...

    VBS脚本控制串口的简单示例

    ### VBS脚本控制串口的简单示例 #### 知识点概述 本文将详细介绍一个简单的使用VBS(Visual Basic Scripting Edition)脚本来控制串口通信的例子。该示例程序非常精简,仅有十行代码,并附带了简单的注释说明。...

    vbs编程实例.txt

    根据给定的VBS脚本实例,我们可以提炼出以下关键的IT知识点: ### VBS(Visual Basic Script Edition)基础 VBS是微软开发的一种轻量级脚本语言,基于VBScript,常用于Windows系统下的自动化任务,如文件操作、...

    vbs脚本手册.doc

    VBS 脚本手册 在这篇手册中,我们将讨论 VBS 脚本手册的重要知识点,包括 Script Runtime Library、FileSystemObject 和磁盘管理。 知识点1:Script Runtime Library Script Runtime Library 是一个单独的 DLL ...

    Vbs脚本编程简明教程.zip_vbs_vbs基础教程_vbs编程

    5. **VBS脚本实例**: - **批处理文件操作**:例如,创建一个脚本删除特定目录下的所有.txt文件。 - **定时任务**:使用Windows的任务计划程序配合VBS编写定时运行的脚本。 - **网页交互**:通过XMLHttpRequest...

    vbs脚本,设置默认打印机

    VBS脚本,全称Visual Basic Script,是一种基于Visual Basic语法的轻量级脚本语言,常用于自动化任务和系统管理。在Windows环境中,VBS脚本可以通过与WScript或CScript交互来执行各种操作,包括对操作系统进行配置,...

    c#(winform)调用VBS脚本

    2. 创建Process实例:创建一个Process实例,用于执行VBS脚本。 ```csharp Process process = new Process(); ``` 3. 设置进程属性:指定VBS脚本解释器(通常是cscript.exe或wscript.exe)和要执行的VBS文件路径。 ...

    wincc 趋势曲线VBS脚本

    在WinCC中,VBS脚本可以用来扩展和自定义HMI的功能,包括添加、删除、修改趋势曲线等。 2. **趋势曲线**: - 趋势曲线是WinCC中的一个重要特性,用于显示数值变量随时间变化的情况。它可以帮助工程师分析设备性能...

    TIA博途Wincc-通过VBS脚本实现电机风扇或水泵旋转动画的具体方法.docx

    总结来说,利用TIA博途Wincc和VBS脚本实现电机风扇或水泵的旋转动画,需要进行项目配置、变量设置、图形列表创建、按钮和IO域的交互设计以及VBS脚本编写。这种方法能帮助用户创建动态且直观的HMI界面,提升系统的可...

    vbs 编程实例vbs 编程实例

    从给定的VBS编程实例中,我们可以提炼出多个关键知识点,这些实例涵盖了VBS脚本的基本用法、网络通信、文件操作、自动化任务以及定时处理等多方面内容。 ### 知识点一:获取本地IP地址 在第一个示例中,通过创建`...

    WinCC中使用VBS脚本实现弹窗和画面切换

    WinCC中使用VBS脚本实现弹窗和画面切换

    显示所有进程vbs脚本

    在这个特定的场景中,"显示所有进程vbs脚本"是用来查看系统当前正在运行的所有进程的工具。这样的脚本可以帮助用户监控系统资源的使用情况,找出可能的性能瓶颈或者潜在的安全风险。 在Windows操作系统中,进程是...

Global site tag (gtag.js) - Google Analytics