https://stackoverflow.com/questions/20437336/how-to-execute-system-command-in-golang-with-unknown-arguments
https://stackoverflow.com/questions/6182369/exec-a-shell-command-in-go
bat 脚本转 go
func ExecStop() error { // TODO fmt.Println("stop") out, err := exec.Command("taskkill", "/f", "/im", "OpenTTD.exe").Output() fmt.Printf("%s\n%s\n", out, err) // TODO out, err = exec.Command("taskkill", "/f", "/im", "p_server.exe").Output() fmt.Printf("%s\n%s\n", out, err) return err } func ExecStart() error { fmt.Println("start") // TODO cmd := exec.Command("C:\\game\\OpenTTDPortable\\OpenTTDPortable.exe") cmd.Start() // TODO cmd = exec.Command("C:\\ga_bin\\bin.win32\\p_server", "C:\\ga_bin\\bin.win32\\config\\server.openttd.conf") cmd.Start() return nil }