Merge pull request #17 from chengziqing/master

hide cmd window
This commit is contained in:
skratchdot 2019-01-03 21:26:28 -05:00 committed by GitHub
commit a2dfa6d0da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -7,6 +7,7 @@ import (
"os/exec"
"path/filepath"
"strings"
"syscall"
)
var (
@ -20,9 +21,13 @@ func cleaninput(input string) string {
}
func open(input string) *exec.Cmd {
return exec.Command(runDll32, cmd, input)
cmd := exec.Command(runDll32, cmd, input)
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
return cmd
}
func openWith(input string, appName string) *exec.Cmd {
return exec.Command("cmd", "/C", "start", "", appName, cleaninput(input))
cmd := exec.Command("cmd", "/C", "start", "", appName, cleaninput(input))
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
return cmd
}