文件操作
Set fso = Wscript.CreateObject("Scripting.FileSystemObject") '创建文件系统对象,用以处理驱动器、文件夹和文件
Set WshShell = Wscript.CreateObject("Wscript.Shell") '创建系统Shell对象,用以运行程序等等
if fso.fileexists("D:刀剑Onlinealreadyexist.txt") then '如果找到文件“D:刀剑 Onlinealreadyexist.txt”则
WshShell.Run("D:刀剑Online刀剑Online.exe") '运行“D:刀剑Online刀剑Online.exe”
elseif fso.fileexists("gengxinupdatedj.exe") then '否则,如果找到“gengxinupdatedj.exe”则
WshShell.Run("gengxinupdatedj.exe") '运行“gengxinupdatedj.exe”
else
WshShell.Run("D:刀剑Online刀剑Online.exe") '否则运行“D:刀剑Online刀剑Online.exe”
end if '根据条件执行语句结束
VBS 导入注册表,然后执行文件
dim Wsh Set Wsh = WScript.CreateObject("WScript.Shell")
Wsh.RegWrite "HKCUSOFTWAREAUDITIONAUTOSTART",0,"REG_DWORD"
Wsh.RegWrite "HKCUSOFTWAREAUDITIONPATH","G:网络游戏劲舞团1.5","REG_SZ"
Wsh.RegWrite "HKCUSOFTWAREAUDITIONVERSION",1010,"REG_DWORD" Wsh.run "patcher.exe"
PING内网 不通就 执行关机 的VBS
strIP = "192.168.0.254" '被PING的内网机器
Set objShell = CreateObject("WScript.Shell")
If Not IsOnline(strIP) Then objShell.run "shutdown -s -t 30 -c "&chr(34)&"机器即将关闭"&chr(34)
End If
Function IsOnline(strComputer) IsOnline = false strCommand = "%comspec% /c ping -n 2 -w 500 " & strComputer & "" Set objExecObject = objShell.Exec(strCommand) Do While Not objExecObject.StdOut.AtEndOfStream strText = objExecObject.StdOut.ReadAll() If Instr(strText, "Reply") > 0 Then IsOnline = true End If Loop End Function
开机脚本VBS用于ARP邦定
Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.run "arp -s 192.168.0.1 30-18-e5-33-01",0
WshShell.run "arp -s 192.168.0.5 30-18-e5-33-07",0
运行程序
Dim a
Set Wsh = WScript.CreateObject("WScript.Shell")
a.Run "d:网络游戏大话西游IIxy-2.exe"
运行 oshell.run "d:softhfhfgame3GameClient.lnk"
断开网络连接
strNICName = " disable =net pci*"
Set objShell = CreateObject("Wscript.Shell")
strCommand = "devcon.exe"& strNICName
objShell.Run strCommand, 0, False
启动网络连接
strNICName = " enable =net pci*"
Set objShell = CreateObject("Wscript.Shell")
strCommand = "devcon.exe"& strNICName
objShell.Run strCommand, 0, False