title: Golang exec .bat or .exe file but don't get output
body: <p>I want to exec .exe file with golang and send the output value in web socket. </p>
  
  <p>It's work great in linux, when I run an bash file but not working in windows with .exe or .bat file (.bat file run .exe file with some parameters). The program was executed but i never see and recive the output of script. My problem is just how to get the output of script in windows. If you can help me it's would be apreciated. </p>
  
  <p>Thanks :)</p>
  
  <pre><code>cmd := exec.Command("cmd", "/C", "file.exe or file.bat", "parameters")
  stdout, err := cmd.StdoutPipe()
  if err != nil {
      panic(err)
  }
  stderr, err := cmd.StderrPipe()
  if err != nil {
      panic(err)
  }
  err = cmd.Start()
  if err != nil {
      panic(err)
  }
  
  scannerOut := bufio.NewScanner(stdout)
  for scannerOut.Scan() {
  
      log.Printf("%s", scannerOut.Text())
  
      err = socket.Emit("test", map[string]interface{}{"user": user, "name": Name, "data": scannerOut.Text()})
      if err != nil {
          log.Println(err)
      }
  }
  </code></pre>
  
  <p>thanks for your help i tried that but again for me the script was executed but i don't have the output :/</p>
  
  <pre><code>output, err := exec.Command("cmd", "/C", cmdPath).CombinedOutput()
  //cmd := exec.Command("ping", "google.fr", "-t")
  //cmd := exec.Command("cmd", "/C", "C:/Users/Cyril/Desktop/zec_miner/miner", "--server", "zec-eu1.nanopool.org", "--user", "t1cjM242nws6QjfGWApeASG9DNDpsrHWv8A.ccl3ouf/cyril.connan@gmail.com", "--pass", "z", "--port", "6666")
  /*stdout, err := cmd.StdoutPipe()*/
  if err != nil {
      panic(err)
  }
  
  log.Printf("%s", string(output))
  
  err = socket.Emit("test", map[string]interface{}{"user": user, "rig_name": rigName, "data": output})
  if err != nil {
      log.Println(err)
  }
  </code></pre>