1.

Solve : how do u make a batch file delete another batch file on exit??

Answer»

i have opened a batch file called colorchange.bat, and it WRITES and calls another one called preferences.bat, which i want only temporarily, as it only contains one line of code.

how do i make it so when i hit the X button on the top right hand corner of colorchange.bat, preferences.bat disappears?
(i kno its possible, i hav cn it happen, but the person i hav cn code it won't show me his code.)

PLEASE HELP US!

kamak, RandomGuywhen you say "hit the X button on the top right hand corner of colorchange.bat"
I guess you MEAN close the WINDOW that have the batfile colorchange.bat
running in it. You should know that the bat-file is just running inside the window
and don't know anything about it. And a bat-file don't have any "destructor"
(if you happen to be a obect oriented programmer) that can start when you
kill the batfile if it is still running.

what you should do instead is at the end of your batfile colorchange.bat
just delete the file preferences.bat
(or directly after the call, whichever you prefer)


make colorchange.bat like this example:

@echo off
echo we have only one earth
echo don't use airplanes

echo %1 %2 %3 > %TEMP%\preferences.bat
call %TEMP%\preferences.bat
del %TEMP%\preferences.bat

echo or soon it is too late to save (what is left of) earth
echo don't be environmental un-friendly
rem (or place the del-line here, this is the last thing done)



Discussion

No Comment Found