Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Delete Executable

Delete Executable

Scheduled Pinned Locked Moved Visual Basic
question
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    _mubashir
    wrote on last edited by
    #1

    Hii all, I know this may seems to be a silly question but I need to know. Is it possible to delete an Executable file from itself. e.g I have an application, I want to delete its executable file from the code written in it. Please reply. Mubashir

    D 1 Reply Last reply
    0
    • _ _mubashir

      Hii all, I know this may seems to be a silly question but I need to know. Is it possible to delete an Executable file from itself. e.g I have an application, I want to delete its executable file from the code written in it. Please reply. Mubashir

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      No, you can't. The .EXE file remains locked open so long as the code in it is loaded into a process. You'll have to quit and have an external process delete this .EXE.

      Dave Kreskowiak Microsoft MVP - Visual Basic

      R 1 Reply Last reply
      0
      • D Dave Kreskowiak

        No, you can't. The .EXE file remains locked open so long as the code in it is loaded into a process. You'll have to quit and have an external process delete this .EXE.

        Dave Kreskowiak Microsoft MVP - Visual Basic

        R Offline
        R Offline
        Ray Cassick
        wrote on last edited by
        #3

        is there a way that you could build an exe file into memory as a separate process and then have it wait for the parent process to die off and then delete it then end and kill itself from memory?


        My Blog[^]
        FFRF[^]


        D 1 Reply Last reply
        0
        • R Ray Cassick

          is there a way that you could build an exe file into memory as a separate process and then have it wait for the parent process to die off and then delete it then end and kill itself from memory?


          My Blog[^]
          FFRF[^]


          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Well, you can load a new Assembly from an array of bytes, documented here[^]. The bytes can either be sourced from emitted code or from data in a file. The problem is creating an entirely new Process out of that Assembly. I don't know how you can get from a loaded assembly to a whole new process.

          Dave Kreskowiak Microsoft MVP - Visual Basic

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups