简体   繁体   中英

Killing a Batch script from another

I have a script that will call other scripts to run then go back to process. Example: Call a script to ping and when it completes, go back to script.

My issue is I have a script called Bounce.bat

Here is the code:

@Echo off
set IPADDRESS=127.0.0.1
set INTERVAL=60

:PINGINTERVAL
ping %IPADDRESS% -n 1
timeout %INTERVAL%
GOTO PINGINTERVAL

What I need is the command that will kill the Bounce.bat from inside another batch script.

I was going to try killing CMD but that kills the original script as well.

I Have tried experimenting as well as looking at script examples.

Does anyone know what is needed to kill this bat only?

You can use the Command "taskkill" to stop other processes in Windows. You can write something like this in your other batch-file: taskkill /IM MYBATCHFILENAME.bat You can force to kill the process, if you are using the parameter /f at the end of your command.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM