Jump to content

How Can I Delete This Batch File?


Recommended Posts

I have a startup.cmd file that runs from the startup folder on logon. It installs some registry tweaks and then it runs a cleanup.cmd that I have in the Temp folder. I have this cleanup.cmd deleting the startup.cmd file from the startup folder, but it won't delete it because the startup.cmd is still running the cleanup.cmd.

Where does this end? Help...lol

Edited by reido113
Link to comment
Share on other sites


I'm going to guess that you are using the CALL command to run cleanup.cmd.

Like CALL cleanup.cmd

Which requires startup.cmd to remain open so that when cleanup.cmd finishes it returns to startup.cmd to run any further commands. If you don't use the CALL statement startup.cmd will continue to run and complete and close then cleanup.cmd shoud be able to delete it.

Or you can create a shortcut to startup.cmd and place that in the startup folder which could be easily deleted since it is only in use when you click on it to run the cmd.

Link to comment
Share on other sites

I'm going to guess that you are using the CALL command to run cleanup.cmd.

Like CALL cleanup.cmd

Which requires startup.cmd to remain open so that when cleanup.cmd finishes it returns to startup.cmd to run any further commands. If you don't use the CALL statement startup.cmd will continue to run and complete and close then cleanup.cmd shoud be able to delete it.

Or you can create a shortcut to startup.cmd and place that in the startup folder which could be easily deleted since it is only in use when you click on it to run the cmd.

I am using start as the command like this..

ECHO.

ECHO Cleaning up leftovers

start %systemdrive%\Install\cleanup.cmd

EXIT

It runs cleanup.cmd but I'm guesin thats the wrong command huh?

CODEDEL /Q /F %0

If this works ... KEWL.. What a shortcut.. lemme try it out.

Thanx y'all

Link to comment
Share on other sites

Djé Posted Today, 01:51 AM

why do you need a startup.cmd AND a cleanup.cmd? Can't you just have the cleanup.cmd in the startup folder?

Deleting itself upon completion:

CODE:

DEL /Q /F %0

BINGO!!!

That did the trick. Y'all never cease to amaze me. I searched (I know; i guess not good enough) for a code like this but no luck.

Thanx Djé! Keep those records spinnin' :thumbup

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...