Advertisement
npocmaka

killer.bat

Apr 25th, 2013
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2.  
  3. setlocal
  4. rem =========================
  5. rem == parsing parameters ==
  6.  
  7. set exe_name=%~1
  8.  
  9. if "%~1" EQU "" (
  10.     goto :help
  11. )
  12.  
  13. if "%~1" EQU "-h" (
  14.     goto :help
  15. )
  16.  
  17. if "%~1" EQU "/h" (
  18.     goto :help
  19. )
  20.  
  21. if "%~1" EQU "?" (
  22.     goto :help
  23. )
  24.  
  25. if "%~1" EQU "/?" (
  26.     goto :help
  27. )
  28.  
  29. shift
  30. for %%A in (/A /a a A) do (
  31.     if "%~1" EQU "%%A" (
  32.         set  "all=/A"
  33.     )
  34. )
  35.  
  36. for %%V in (/V /v v V) do (
  37.     if "%~1" EQU "%%V" (
  38.         set "verbose=/V"
  39.     )
  40. )
  41.  
  42. shift
  43. for %%A in (/A /a a A) do (
  44.     if "%~1" EQU "%%A" (
  45.         set  "all=/A"
  46.     )
  47. )
  48.  
  49. for %%V in (/V /v v V) do (
  50.     if "%~1" EQU "%%V" (
  51.         set "verbose=/V"
  52.     )
  53. )
  54. rem =========================
  55.  
  56.  
  57. for /f "tokens=2 delims= " %%M  in ('tasklist ^| find ^"%exe_name%^"') do (
  58.     tskill "%%M"  %verbose% %all%
  59. )
  60. endlocal
  61. goto :eof
  62.  
  63. :help
  64. echo.
  65. echo  %~n0 - allows you to kill a process by image without administrator permissions.
  66. echo.
  67. echo  %~n0 executable [/V] [/A]
  68. echo.
  69. echo    executable             executable to be terminated.
  70. echo    /V                     verbose information
  71. echo    /A                     End process running under ALL sessions
  72. echo.
  73. echo  by Vasil "npocmaka" Arnaudov
  74.  
  75. goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement