[日常]windows下kill进程工具taskkill
2023-02-18 15:41:13 时间
linux下可以使用 kill 进程id 来杀死一个运行中的进程
windows下可以使用 taskkill.exe /f /pid 进程id
平常可能我们不会使用这样的命令来杀死进程
但是在写代码的过程中如果想在代码里kill进程
就可以使用这个方式了
比如下面的go代码
var command *exec.Cmd if runtime.GOOS == "windows" { command = exec.Command("taskkill.exe", "/f", "/pid", string(strb)) } else { command = exec.Command("kill", string(strb)) } command.Start()
相关文章
- 安卓项目五子棋代码详解(三)
- 安卓项目五子棋代码详解(二)
- 安卓项目五子棋代码详解(一)
- 3xx HTTP状态码的终极指南
- React报错之React.Children.only expected to receive single React element child
- React报错之Element type is invalid
- React报错之Too many re-renders
- React报错之Function components cannot have string refs
- 如何发布一个 TypeScript 编写的 npm 包
- 如何使用zx编写shell脚本
- 13个构建RESTful API的最佳实践
- 什么是REST API
- React报错之Rendered more hooks than during the previous render
- 如何使用CSS伪类选择器
- React报错之Property 'value' does not exist on type EventTarget
- React报错之Parameter 'event' implicitly has an 'any' type
- React报错之Parameter 'props' implicitly has an 'any' type
- React报错之Property 'value' does not exist on type 'HTMLElement'
- React报错之You provided a `checked` prop to a form field
- React报错之Invalid hook call