4

On windows, how I can execute a command from Go's exec without opening a terminal window?

eg:

cmd := exec.Command("ping", "www.google.com")
if err := cmd.Run(); err != nil {
  return err
}

This opens a cmd window when running the command.

I compile it with go build -ldflags="-H windowsgui", the app then doesn't open a cmd window, but when it gets to cmd.Run() it opens one.

big pigeon
  • 85
  • 5
microo8
  • 3,568
  • 5
  • 37
  • 67

0 Answers0