Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 133391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:25:26+00:00 2026-05-11T06:25:26+00:00

I need to shut down my application and then delete the executable. I am

  • 0

I need to shut down my application and then delete the executable. I am doing it by kicking off a low priority batch job and then immediately shutting down the exe. Is there a better way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T06:25:27+00:00Added an answer on May 11, 2026 at 6:25 am

    As long as any code from an executable is in memory, it cannot be deleted, but there are some other things you can try:

    • Telling MoveFileEx to defer the delete until next reboot is one approach typically used by install/uninstall code.
    • Use the Task Scheduler to schedule cmd.exe /c del c:\path\myprog.exe to run 60 seconds from now, then quit promptly so it has a chance of succeeding.
    • A batch file works well and can actually delete itself because a batch file is closed between lines.

    If you’re using the batch file method, consider something like the following:

    :loop ping -n 6 127.0.0.1 del /y %1 if exist %1 goto :loop del byebye.bat 

    The ping command here is being abused to insert a delay, since sleep is not a standard command on Windows. The loop enables the batch process to bide its time until it can actually remove the executable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need to locate the following pattern: The letter I followed by a space then
I am developing a Blackberry Java application and I need an update count in
I have an application in which I need to kill the application after it
I'm doing a multi-layer MVVM WPF application, which is connected to an Oracle database.
I need to terminate the running threads to shutdown application. After executing common application
I need an application architecture advise. I am building a .Net 4 WPF desktop
I have an application that I'd like to shutdown gracefully when Windows shuts down
Basically I need a suggestion about making an iOS application, where I can connect
I need execute some code before Windows shutdown process each time. So, I want
Need a function that takes a character as a parameter and returns true if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.