温馨提示

选择或填写下载券数量必须是整数

首页 vbs代码大全

vbs代码大全

24人阅读 36 22KB
思憶漫長
2019-12-12上传 侵权/举报

<div>

 <div class="Section1">

  <p class="MsoNormal"><span style="font-family:宋体">1. 计算</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">2. 处理文件和文件夹</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">3. 管理Windows</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">4. 处理Word, Excel, PowerPoint等Office文档</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">5. 嵌入网页,驱动dHTML</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">6. 编写HTTP通信</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">7. 调用系统功能(COM组件),比如说语音说话</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">8. 分析HTML, XML</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">9. 调用命令行并分析返回结果</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">10. 处理图片</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">11. 自动化按键</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">12. 调用Windows Media Player并管理</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">13. 调用Windows Live Messenger并管理</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">14. 服务端技术:Active Server Page (ASP)</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">15. 脚本病毒</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">16. 处理数据库</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">VBS获取系统安装路径</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">先定义这个变量是获取系统安装路径的,然后我们用”&amp;strWinDir&amp;”调用这个变量。</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">set WshShell = WScript.CreateObject("WScript.Shell")</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">strWinDir = WshShell.ExpandEnvironmentStrings("%WinDir%")VBS获取C:\Program Files路径msgbox CreateObject("WScript.Shell").ExpandEnvironmentStrings("%ProgramFiles%")</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">VBS获取C:\Program Files\Common Files路径</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">msgbox CreateObject("WScript.Shell").ExpandEnvironmentStrings("%CommonProgramFiles%")</span></p>


  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">给桌面添加网址快捷方式</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">set gangzi = WScript.CreateObject("WScript.Shell")</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">strDesktop = gangzi.SpecialFolders("Desktop")</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">set oShellLink = gangzi.CreateShortcut(strDesktop &amp; "\Internet Explorer.lnk")</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">oShellLink.TargetPath = "http://www.fendou.info"</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">oShellLink.Description = "Internet Explorer"</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">oShellLink.IconLocation = "%ProgramFiles%\Internet Explorer\iexplore.exe, 0"</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">oShellLink.Save</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:Times New Roman"><br></span></p>

 </div>

</div><div>

 <div class="Section1">

  <p class="MsoNormal"><span style="font-family:宋体">给收藏夹添加网址</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">Const ADMINISTRATIVE_TOOLS = 6</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">Set objShell = CreateObject("Shell.Application")</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">Set objFolder = objShell.Namespace(ADMINISTRATIVE_TOOLS)</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">Set objFolderItem = objFolder.Self<span style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">Set objShell = WScript.CreateObject("WScript.Shell")</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">strDesktopFld = objFolderItem.Path</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">Set objURLShortcut = objShell.CreateShortcut(strDesktopFld &amp; "\奋斗Blog.url")</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">objURLShortcut.TargetPath = "http://www.fendou.info/"</span></p>


  <p class="MsoNormal"><span style="font-family:宋体">objURLShortcut.Save</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">删除指定目录指定后缀文件</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">On Error Resume Next</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">Set fso = CreateObject("Scripting.FileSystemObject")</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">fso.DeleteFile "C:\*.vbs", True</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">Set fso = Nothing</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">VBS改主页</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">Set oShell = CreateObject("WScript.Shell")</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">oShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Start Page","http://www.fendou.info"</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">VBS加启动项</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">Set oShell=CreateObject("Wscript.Shell")</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">oShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Run\cmd","cmd.exe"</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">VBS复制自己</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">set copy1=createobject("scripting.filesystemobject")</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">copy1.getfile(wscript.scriptfullname).copy("c:\huan.vbs")</span></p>

  <p class="MsoNormal"><span style="font-family:Times New Roman"><br></span></p>

 </div>

</div><div>


 <div class="Section1">

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">复制自己到C盘的huan.vbs(复制本vbs目录下的game.exe文件到c盘的gangzi.exe)</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">set copy1=createobject("scripting.filesystemobject")</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">copy1.getfile("game.exe").copy("c:\gangzi.exe")</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">VBS获取系统临时目录</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">Dim fso</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">Set fso = CreateObject("Scripting.FileSystemObject")</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">Dim tempfolder</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">Const TemporaryFolder = 2</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">Set tempfolder = fso.GetSpecialFolder(TemporaryFolder)</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">Wscript.Echo tempfolder</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">就算代码出错 依然继续执行</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">On Error Resume Next</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">VBS打开网址</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>

  <p class="MsoNormal"><span style="font-family:宋体">Set objShell = CreateObject("Wscript.Shell")</span></p>

  <p class="MsoNormal"><span style="font-family:宋体">objShell.Run("http://www.fendou.info/")</span></p>

  <p class="MsoNormal"><span style="font-family:宋体"><br></span></p>


已收藏至个人中心

点击个人中心可查看

1/36

最多预览50页

VIP
权益

我看
过的

上传
资料

联系
客服

在线客服

工作日:10:00-18:00

联系客服

下载
APP

扫码下载APP

资料同步不丢失

投诉
反馈

关注
领奖

会员权益

欢迎来到爱问共享资料

开通VIP 立即尊享会员权益
  • 专享
    下载特权

  • 现金文档
    8折起

  • VIP专区
    免费下载

  • 千万文档
    免费下载

  • VIP
    悬赏通道

  • 专属客服

  • 会员
    尊贵标识

  • 上传文档
    扩容

  • 优选内容
    推荐

  • VIP
    专享活动

  • 上传内容自定义
    预览

  • 多终端互通

  • 办公频道
    无广告浏览

开通VIP