github.com/searKing/golang/go@v1.2.117/os/exec/kill_windows.go (about)

     1  // Copyright 2020 The searKing Author. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package exec
     6  
     7  import "os/exec"
     8  
     9  func KillProcByName(pname string) {
    10  	params := []string{
    11  		"taskkill",
    12  		"/F",
    13  		"/IM",
    14  		pname,
    15  		"/T",
    16  	}
    17  	exec.Command(params[0], params[1:]...).CombinedOutput()
    18  }