Ali Shuaib
Ali Shuaib

Reputation: 31

How can I keep a bat file repeating constantly?

sorry if I am using wrong terms, I am new to this stuff. so I have been trying to get this command (taskkill /f /t /im (the process)) to keep repeating because the process that I am trying to kill keeps coming back. so I thought if i can get the command to keep repeating it will keep the process closed. please I would like some help, thank you.

Upvotes: 3

Views: 442

Answers (1)

UnknownOctopus
UnknownOctopus

Reputation: 2277

Just loop through

@echo off

:loop
taskkill /f /t /im (the process)
goto loop

Or add a delay using ping or timeout

@echo off

:loop
taskkill /f /t /im (the process)
timeout /t 30 /nobreak >nul rem Change out 30 for the number of seconds needed in the delay
goto loop

As @MrLister said in the comments above, address the problem directly. Ask yourself "did i get this program from a reliable source?" if not, it could be malicious. If it is safe, then why is this behavior occurring? Could it be scheduled with taskscheduler? Best of luck.

Upvotes: 1

Related Questions