Created
August 11, 2017 00:39
-
-
Save albertofwb/c72e1b79bb9f6e0c874adf6ee27ad819 to your computer and use it in GitHub Desktop.
模仿linux下的pkill 命令实现。 将该脚本放入 PATH 中。关闭任何程序只需要 pkill ProcessName. 比如关闭 Chrome.exe 只需要 pkill chrome
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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