18 lines
405 B
Go
18 lines
405 B
Go
|
|
//go:build windows
|
||
|
|
|
||
|
|
package main
|
||
|
|
|
||
|
|
import (
|
||
|
|
"os/exec"
|
||
|
|
"syscall"
|
||
|
|
)
|
||
|
|
|
||
|
|
// noWindow sets CREATE_NO_WINDOW on the command so that spawning powershell,
|
||
|
|
// rundll32, or any other subprocess never flashes a console/DOS window on
|
||
|
|
// the user's desktop. Must be called before cmd.Start().
|
||
|
|
func noWindow(cmd *exec.Cmd) {
|
||
|
|
cmd.SysProcAttr = &syscall.SysProcAttr{
|
||
|
|
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
||
|
|
}
|
||
|
|
}
|