say i have the following code, using syscall
to hide command line window
process := exec.Command(name, args...)
process.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
err := process.Start()
if err != nil {
log.Print(err)
}
but when i compiled it and tried to run it in Windows, command line window showed up again
what can i do to prevent command line window from appearing?
PS i already know how to compile golang source into a Windows GUI executable using go build -ldflags -H=windowsgui
, but doing so only ensures the program itself doesn't bring up a command line window, Exec
will show those windows anyway
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…