首先,这不是复制自身,而是创建快捷方式;其次,你没准备干好事儿吧- AddStartup WSH.ScriptFullName
-
- Do Until Ping("g.cn")
- WSH.Sleep 1000 * 3
- Loop
-
- WSH.Sleep 1000 * 60
- RunExe "abc.exe"
-
-
-
- Sub AddStartup(strValue)
- Const HKEY_LOCAL_MACHINE = &H80000002
-
- strComputer = "."
-
- Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
- strComputer & "\root\default:StdRegProv")
-
- strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
- strValueName = "MyStartup"
- oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
- End Sub
-
- Function Ping(machine)
- Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
- ExecQuery("select * from Win32_PingStatus where address = '"_
- & machine & "'")
- For Each objStatus in objPing
- If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then
- Ping = False
- Else
- Ping = True
- End If
- Next
- End Function
-
- Sub RunExe(pro)
- CreateObject("WScript.Shell").Run pro
- End Sub
复制代码
|