Results 1 to 17 of 17

Thread: [RESOLVED] Deleting my own exe

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2009
    Location
    Clive, IA in America!!!!
    Posts
    204

    Resolved [RESOLVED] Deleting my own exe

    I am creating an uninstall program, but I want to also remove the uninstaller. However, the uninstaller is currently running... How can I accomplish this?

    VBNetDude - Thinking Programmatically
    By Silver Seal Software

    Don't forget to mark your thread as "Resolved" using the Thread Tools menu on top. And don't forget to rate the answers that help you the most!

  2. #2
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    Re: Deleting my own exe

    Why prevent people from uninstalling your application ( which is the way installing & uninstalling programs usually work ) ¿
    VB.NET MVP 2008 - Present

  3. #3
    Hyperactive Member BillGeek's Avatar
    Join Date
    Jun 2006
    Location
    Canada
    Posts
    440

    Re: Deleting my own exe

    I think he's talking about actually uninstalling the application...

    Just a guess: You could add an item in the "RunOnce" registry key that will delete the uninstaller when the system reboots... I don't know if this would work, but the command seems to be pretty simple:
    Code:
    del c:\path\app.exe /y

  4. #4
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: Deleting my own exe

    that command actually will flash a black command window on the screen, convincing a lot of users they have spyware. Not that it isn't mostly correct, but you "may" have to call cmd.exe and pass the rest as a parameter, as del doesn't actually exist as a file to run.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  5. #5
    gibra
    Guest

    Re: Deleting my own exe

    Quote Originally Posted by BillGeek View Post
    I think he's talking about actually uninstalling the application...

    Just a guess: You could add an item in the "RunOnce" registry key that will delete the uninstaller when the system reboots... I don't know if this would work, but the command seems to be pretty simple:
    Code:
    del c:\path\app.exe /y
    This work ONLY if the user is connected with Administrator credentials, otherwise you haven't access to Registry.


  6. #6
    gibra
    Guest

    Re: Deleting my own exe

    Quote Originally Posted by VBNetDude View Post
    I am creating an uninstall program, but I want to also remove the uninstaller. However, the uninstaller is currently running... How can I accomplish this?
    This mean? Mean that your program:
    1 - get all References used by program that you want unistall?
    2 - decrease the counter references correctly?
    3 - un-register references if and only if no longer used by any other programs?
    4 - delete references-file if and only if where no longer used (see 3)?
    5 - save (not uninstall) references-file used by system?
    6 - remove all files installed from original application setup?
    7 - remove folder created from original application setup?
    8 - ...........


  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Oct 2009
    Location
    Clive, IA in America!!!!
    Posts
    204

    Re: Deleting my own exe

    Quote Originally Posted by gibra View Post
    This mean? Mean that your program:
    1 - get all References used by program that you want unistall?
    2 - decrease the counter references correctly?
    3 - un-register references if and only if no longer used by any other programs?
    4 - delete references-file if and only if where no longer used (see 3)?
    5 - save (not uninstall) references-file used by system?
    6 - remove all files installed from original application setup?
    7 - remove folder created from original application setup?
    8 - ...........

    Yes. I have actually done all the dirty work. Now I just have one executable running. That is the uninstaller. I want to remove that uninstaller as well. This way ALL of the files are removed (even the uninstaller) So......

    8 - Remove uninstaller executable by either registry 'RunOnce' of some other method.

    VBNetDude - Thinking Programmatically
    By Silver Seal Software

    Don't forget to mark your thread as "Resolved" using the Thread Tools menu on top. And don't forget to rate the answers that help you the most!

  8. #8
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Deleting my own exe

    I am creating an uninstall program, but I want to also remove the uninstaller. However, the uninstaller is currently running... How can I accomplish this?
    If you use InnoSetup to create a Package then you don't need to create an uninstaller or worry about it being running after you uninstall it. It takes care of everything...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  9. #9
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Deleting my own exe

    Quote Originally Posted by koolsid View Post
    If you use InnoSetup to create a Package then you don't need to create an uninstaller or worry about it being running after you uninstall it. It takes care of everything...
    While I've never used it and I'm sure it's as good as you say, I will be very disappointed if this thread is ended here because of it. Ya, gotta admit that this is an interesting topic and a VB based solution would make it even more so.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  10. #10
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: Deleting my own exe

    the correct way is placing a command the system itself will run when it feels like it. Runonce is usually the place and some programs such as spybot actually use a shelled del command. Personally i don't like that because of the black screen you get, but it doesn't leave ANY traces behind.

    as for administrator privelages someone else was going on about... an uninstaller program MUST have admin privelages or windows won't let the program be uninstalled anyway. Prevents limited users from screwing up a system.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  11. #11
    Member
    Join Date
    Jul 2009
    Posts
    33

    Re: Deleting my own exe

    1) try to use a .BAT or
    2) try to use something like "unlock opened files".

    Good luck

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Oct 2009
    Location
    Clive, IA in America!!!!
    Posts
    204

    Re: Deleting my own exe

    Quote Originally Posted by h2so4 View Post
    2) try to use something like "unlock opened files".
    How would I do that?

    VBNetDude - Thinking Programmatically
    By Silver Seal Software

    Don't forget to mark your thread as "Resolved" using the Thread Tools menu on top. And don't forget to rate the answers that help you the most!

  13. #13
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Deleting my own exe

    Here's code that deletes an exe from the Form_Unload of that exe. You can probably adapt it to your purpose.

    BTW, I sent you a PM yesterday that you haven't reponded to yet.


    Code:
    Private Sub Form_Unload(Cancel As Integer)
    
        Open App.Path & "\del.bat" For Output As #1
        Print #1, ":start"
        Print #1, "@echo off"
        Print #1, "cls"
        Print #1, "del " & Chr$(34) & App.Path & "\" & App.EXEName & ".exe" & Chr$(34)
        Print #1, "if  exist " & Chr$(34) & App.Path & "\" & App.EXEName & ".exe" & Chr$(34) & " goto start"
        Print #1, "del " & Chr$(34) & App.Path & "\" & "del.bat" & Chr$(34)
        Close #1
        Shell App.Path & "\" & "del.bat"
    
    End Sub

  14. #14

    Thread Starter
    Addicted Member
    Join Date
    Oct 2009
    Location
    Clive, IA in America!!!!
    Posts
    204

    Re: Deleting my own exe

    Thanks, I will try that!

    Oh, and the PM... meant to take care of that... Sorry!

    EDIT:
    There you go!

    VBNetDude - Thinking Programmatically
    By Silver Seal Software

    Don't forget to mark your thread as "Resolved" using the Thread Tools menu on top. And don't forget to rate the answers that help you the most!

  15. #15
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Deleting my own exe

    Quote Originally Posted by MartinLiss View Post
    Here's code that deletes an exe from the Form_Unload of that exe. You can probably adapt it to your purpose.
    Martin, that code is just very clever. Gonna bookmark this.
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  16. #16
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    Re: Deleting my own exe

    Sorry for the initial confusion VBNetDude, I didn't read properly
    VB.NET MVP 2008 - Present

  17. #17

    Thread Starter
    Addicted Member
    Join Date
    Oct 2009
    Location
    Clive, IA in America!!!!
    Posts
    204

    Re: Deleting my own exe

    Quote Originally Posted by HanneSThEGreaT View Post
    Sorry for the initial confusion VBNetDude, I didn't read properly
    Ha! I have done it a few times as well!

    Edit: The Code from MartinLiss Works Great! Thankyou so much!
    Last edited by VBNetDude; Dec 5th, 2009 at 02:38 PM.

    VBNetDude - Thinking Programmatically
    By Silver Seal Software

    Don't forget to mark your thread as "Resolved" using the Thread Tools menu on top. And don't forget to rate the answers that help you the most!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width