Computing.Net > Forums > Programming > delete itself and close the window

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

delete itself and close the window

Reply to Message Icon

Name: eqagunn
Date: March 13, 2009 at 21:01:24 Pacific
OS: Windows Vista Ultimate SP1 x64
CPU/Ram: 2 GB
Subcategory: Batch
Comment:

One batch file uses start command to open another.

Just like the description in "start /?" sais:

If it is an internal command or a batch file then
the command processor is run with /K switch to cmd.exe.
This means that window will remain after the command
has been run.

Adding the exit command at the end of batch file
will close the window.

The thing is I need that second batch to delete itself,
and then exit.

del %0
exit

But, of course, after file deletes itself exit command
won't be run and window will remain open.

I had in mind using call to open the second batch,
and then using taskkill to close the first one.
This way the second batch would close automatically
after it deletes itself.

But both batches are cmd.exe processes and
therefore I can't specify which one to kill.

Does anyone has an idea how to do this?



Sponsored Link
Ads by Google

Response Number 1
Name: Judago
Date: March 13, 2009 at 21:09:41 Pacific
Reply:

Try:

Start cmd /c "<batch>"


0

Response Number 2
Name: eqagunn
Date: March 14, 2009 at 04:30:32 Pacific
Reply:

Works like a charm. :D


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: delete itself and close the window

popup and close window www.computing.net/answers/programming/popup-and-close-window/6696.html

batch help? anyone? www.computing.net/answers/programming/batch-help-anyone/16098.html

Automatically make a VPN w/ script? www.computing.net/answers/programming/automatically-make-a-vpn-w-script/15901.html