软件下载 | 资讯教程 | 最近更新 | 下载排行 | 一键转帖 | 发布投稿
您的位置:最火下载站 > 电脑教程 > 编程开发 > vb开发 > VB定时5分钟复制文件并实现开机自启动

VB定时5分钟复制文件并实现开机自启动

VB 定时5分钟复制文件 开机自启动的例子,本实例来自《K8拉登哥哥的博客》,欢迎大家一起学习!

代码如下:

Dim i As Integer
Dim SouceFile, TargetFile
Dim DosCommand As String

Private Sub Form_Load()
On Error Resume Next
Timer1.Interval = 60000

SouceFile = "d:\K8team.txt"
TargetFile = "d:\K8test.txt"
DosCommand = "copy d:\k8team.txt d:\b333bb.txt"

App.TaskVisible = False

Set w = CreateObject("wscript.shell")
w.regwrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\" & App.EXEName, App.Path & "\" & App.EXEName & ".exe"

End Sub

Private Sub Timer1_Timer()
On Error Resume Next
i = i + 1
If i = 5 Then
FileCopy SouceFile, TargetFile
Shell "cmd.exe /c " + DosCommand, vbHide
i = 0
End If
End Sub

    相关阅读
    网友评论