Sign in with
Sign up | Sign in

Stop command in midway and restart it.

Last response: in Applications
Share

Try using something like the following.

Replace <commandToRun> with what you actually want to execute and <thisbatchfile> as the name. The ping command is just pinging an address that doesn't exist with a 10 second timeout.

  1. <commandToRun>
  2. ping 123.45.67.89 -n 1 -w 10000 > nul
  3. taskkill /F /IM <commandToRun>
  4. call <thisbatchfile>

Vitaminzed said:
This won't work, because the <commandToRun> is a never ending command.


You might have viewed my reply before I edited it. Initially I had forgotten the taskkill statement so in that scenario then you would have just had n running instances of the command.

But with the taskkill statement and the /F flag then the process will be killed off
Ask the community
!