package installer import ( "context" "os/exec" "syscall" ) func newShellCommand(ctx context.Context, script string) *exec.Cmd { cmd := exec.CommandContext(ctx, "cmd.exe", "/D", "/S", "/C", script) // cmd.exe parses embedded quotes differently from CommandLineToArgvW. // /S removes this one outer quote pair and leaves the script untouched; // /D disables unrelated AutoRun commands from the user's shell settings. cmd.SysProcAttr = &syscall.SysProcAttr{CmdLine: `"` + cmd.Path + `" /D /S /C "` + script + `"`} return cmd }