1.

Solve : closing a batch?

Answer»

i know you can run a batch file using "call ..." but once one is RUNNING can you close it from another batch file?

like one batch opens another batch once the original batch GETS to a point it closes the 2nd batch process that is running?You can use START "Windowtitle" "batch.bat" to start it and TASKKILL /F /FI "WINDOWTITLE eq Windowtitle*" to kill it

Windowtitle999 is just an example. Any text string will do.

Quote


@echo off

REM create batch to be killed
echo @echo off > tobekilled.bat
echo echo this batch is to be killed by >> tobekilled.bat
echo echo the batch that CALLED it >> tobekilled.bat
echo echo waiting to die... >> tobekilled.bat
echo :loop >> tobekilled.bat
echo goto loop >> tobekilled.bat

REM start batch with a specified windowtitle
start "WindowTitle999" "tobekilled.bat"

REM ask user to ENTER a dummy string
Set /P key=press ENTER to kill the batch you just started %

REM now kill off task with specified window title
REM asterisk seems to be essential
taskkill /F /FI "WINDOWTITLE eq WindowTitle999*"

pause



Ok i tried this but i get the message "taskkill" is not an internal or external command, operable program or batch file

please help!!!If you are running an antique OS like 98 or ME I cannot help you.

If you are running XP Home or Windows 2000 it is not included I think.

Here is a download link. http://home.wanadoo.nl/gigajosh/files/taskkill_en.zip

Unzip it and copy it somewhere on your path. The standard place on XP Pro is

C:\WINDOWS\system32\taskkill.exe





Discussion

No Comment Found