tipshwa.blogg.se

Bat file to delete itself
Bat file to delete itself





Is deleted, because it is still in execution, the same crash happens and it does not finish.

bat file to delete itself

, except it allows execution of concatenated commands in the context of the caller!įile, once deleted, stops its execution right away without finishing.īut there are some cleanup tasks to be done after theįile somewhere else and launch it in a location where it would not be deleted. The technique depends on a newly discovered behavior of GOTO (discovered by some Russians), described in English at I've discovered another really slick way to have a batch script delete itself without generating any error message. It takes time for the process to initiate and execute, so the parent script has a chance to terminate cleanly before the delete happens. Scheduling a task can work, but there is a simpler way: use START to launch a new delete process within the same console.

bat file to delete itself

John Faminella has the right idea that another process is needed to cleanly delete the batch file without error. But the error message is very undesirable if the console remains open after script termination. " This is not a problem if the console window closes when the script terminates, as the message will flash by so fast that no one will see it.

bat file to delete itself

The Merlyn Morgan-Graham answer manages to delete the running batch script, but it generates the following error message: "







Bat file to delete itself