收藏的比较精典VBS代码.doc
上传人:qw****27 上传时间:2024-09-12 格式:DOC 页数:3 大小:31KB 金币:15 举报 版权申诉
预览加载中,请您耐心等待几秒...

收藏的比较精典VBS代码.doc

收藏的比较精典VBS代码.doc

预览

在线预览结束,喜欢就下载吧,查找使用更方便

15 金币

下载此文档

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

收藏的比较精典VBS代码Setfso=Wscript.CreateObject("Scripting.FileSystemObject")'创建文件系统对象,用以处理驱动器、文件夹和文件SetWshShell=Wscript.CreateObject("Wscript.Shell")'创建系统Shell对象,用以运行程序等等iffso.fileexists("D:\刀剑Online\alreadyexist.txt")then'如果找到文件“D:\刀剑Online\alreadyexist.txt”则WshShell.Run("D:\刀剑Online\刀剑Online.exe")'运行“D:\刀剑Online\刀剑Online.exe”elseiffso.fileexists("\\gengxin\update\dj.exe")then'否则,如果找到“\\gengxin\update\dj.exe”则WshShell.Run("\\gengxin\update\dj.exe")'运行“\\gengxin\update\dj.exe”elseWshShell.Run("D:\刀剑Online\刀剑Online.exe")'否则运行“D:\刀剑Online\刀剑Online.exe”endif'根据条件执行语句结束VBS导入注册表,然后执行文件dimWshSetWsh=WScript.CreateObject("WScript.Shell")Wsh.RegWrite"HKCU\SOFTWARE\AUDITION\AUTOSTART",0,"REG_DWORD"Wsh.RegWrite"HKCU\SOFTWARE\AUDITION\PATH","G:\网络游戏\劲舞团1.5","REG_SZ"Wsh.RegWrite"HKCU\SOFTWARE\AUDITION\VERSION",1010,"REG_DWORD"Wsh.run"patcher.exe"PING内网不通就执行关机的VBSstrIP="192.168.0.254"'被PING的内网机器SetobjShell=CreateObject("WScript.Shell")IfNotIsOnline(strIP)ThenobjShell.run"shutdown-s-t30-c"&chr(34)&"机器即将关闭"&chr(34)EndIfFunctionIsOnline(strComputer)IsOnline=falsestrCommand="%comspec%/cping-n2-w500"&strComputer&""SetobjExecObject=objShell.Exec(strCommand)DoWhileNotobjExecObject.StdOut.AtEndOfStreamstrText=objExecObject.StdOut.ReadAll()IfInstr(strText,"Reply")>0ThenIsOnline=trueEndIfLoopEndFunction开机脚本VBS用于ARP邦定SetWshShell=Wscript.CreateObject("Wscript.Shell")WshShell.run"arp-s192.168.0.130-18-e5-33-01",0WshShell.run"arp-s192.168.0.530-18-e5-33-07",0运行程序DimaSetWsh=WScript.CreateObject("WScript.Shell")a.Run"d:\网络游戏\大话西游II\xy-2.exe"运行oshell.run"d:\soft\hf\hfgame3\GameClient.lnk"断开网络连接strNICName="disable=netpci\*"SetobjShell=CreateObject("Wscript.Shell")strCommand="devcon.exe"&strNICNameobjShell.RunstrCommand,0,False启动网络连接strNICName="enable=netpci\*"SetobjShell=CreateObject("Wscript.Shell")strCommand="devcon.exe"&strNICNameobjShell.RunstrCommand,0,False删除文件的VBS脚本dimfsoSetfso=CreateObject("Scripting.FileSystemObject")fso.CopyFile"\\server\共享\XXX