我是要删除本身的exe文件

解决方案 »

  1.   

    我有一个想法,但不知道是否可行。那就是做两个程序,当一个御载时用shell运行另一个程序,后来的这个程序运行后就把前面已经关闭的你想删的那个文件删了。但这个方法始终都有一个删不了。
      

  2.   

    autoexec.bat  也是一个办法http://www2.baidu.com/chains/chains.php?cn=cwwnet1                  欢迎进入http://www2.baidu.com/chains/chains.php?cn=cwwnet1
      

  3.   

    那就是做两个程序,当一个御载时用shell运行另一个程序,后来的这个程序运行后就把前面已经关闭的你想删的那个文件删了
      

  4.   

    Private Sub DeleteMe()
    '-----------Create bat-file---------------
      Open App.Path + "\Delself.bat" For Append As #1
      Print #1, "@echo off"
      Print #1, ":try"
      Print #1, "del " + App.EXEName + ".exe"
      Print #1, "if exist " + App.EXEName + ".exe goto try"
      Print #1, "del " + App.Path + "\Delself.bat"
      Close
    '-----------Executr it-------------------
      Shell App.Path + "\Delself.bat", vbHide
    End SubAt Form_Unload (or at the end of Sub_Main)
    just call:DeleteMe
      

  5.   

    一个自杀程序  --------------------------------------------------------------------------------
    下面的代码演示将一个程序在执行时将自己删除。
    Sub KillMe()
      Path = App.Path
      If Right(Path, 1) <> "\" Then Path = Path + "\"
      PathName = Path + App.EXEName + ".EXE"
      BatName = Path + "1.bat"
      Open BatName For Output As #1
      Print #1, ":START"
      Print #1, "del " & PathName
      ' Print #1, "if exist " & BatName & " GOTO START"
      Print #1, "del " & BatName
      Close #1
      Shell BatName, vbHide
      End
    End Sub注:' Print #1, "if exist " & BatName & " GOTO START"
    这一句有的机加了不能把那个.bat删了,有的可以自己看看!