导入包
import "github.com/gonutz/ide/w32"
//隐藏console
func HideConsole(){
    ShowConsoleAsync(w32.SW_HIDE)
}
//显示console
func ShowConsole(){
ShowConsoleAsync(w32.SW_SHOW)
}
//
func ShowConsoleAsync(commandShow uintptr){
console := w32.GetConsoleWindow()
if console != 0 {
_, consoleProcID := w32.GetWindowThreadProcessId(console)
if w32.GetCurrentProcessId() == consoleProcID {
w32.ShowWindowAsync(console, commandShow)
}
}
}
引用链接: https://stackoverflow.com/questions/23250505/how-do-i-create-an-executable-from-golang-that-doesnt-open-a-command-cmd-wind

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。