Bash 脚本:在重新执行之前终止实例

Bash 脚本:在重新执行之前终止实例

我有一个用于启动开发环境的批处理脚本。它看起来像这样

:: Update checkout
git pull
:: Compile code with Maven
call mvn clean install -Pui
:: File for a program called Free File Synch which persists changes from one
:: part of the file system (my checkout) to another (the static cache generated
:: by Maven)
source-to-server.ffs_real

:: Navigate to the front-end
cd .\target\frontend
:: Serve to localhost
python -m SimpleHTTPServer 80

我想做的是终止由source-to-server.ffs_real(它被称为RealtimeSync.exe) 启动的进程 — 换句话说,在设置之前包含一种拆卸。我在其他地方读过和,pkillkillall这些在我的 PATH 中不可用。肯定有一种 Windows 原生的方式来做到这一点?

答案1

优美:

  • taskkill /IM RealtimeSync.exe

强制:

  • taskkill /F /IM RealtimeSync.exe
  • wmic process where name="RealtimeSync.exe" delete
  • wmic process where name="RealtimeSync.exe" call terminate

相关内容