Skip to content

Instantly share code, notes, and snippets.

@albertofwb
Created August 11, 2017 00:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save albertofwb/c72e1b79bb9f6e0c874adf6ee27ad819 to your computer and use it in GitHub Desktop.
Save albertofwb/c72e1b79bb9f6e0c874adf6ee27ad819 to your computer and use it in GitHub Desktop.
模仿linux下的pkill 命令实现。 将该脚本放入 PATH 中。关闭任何程序只需要 pkill ProcessName. 比如关闭 Chrome.exe 只需要 pkill chrome
@echo off
set App=%1
if "%App%" == "" (
goto usage
)
if "%App:~-3%" neq "exe" (
set App=%App%.exe
)
taskkill /f /im %App%
if errorlevel 1 goto invalid
goto done
:usage
echo %0 AppName
goto done
:invalid
echo can't find %App%
goto done
:done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment