从Golang执行web2exe给我“退出状态2”

Im trying the following, to use go to bundle a folder of html files using the CMD web2exe.

cmd := exec.Command("web2exe-win.exe", "html-folder --main index.html --export- to windows-x32 --output-dir")
var out bytes.Buffer
cmd.Stdout = &out
err := cmd.Run()
if err != nil {
    fmt.Println(err)
}
fmt.Println(out)

When a program exits non-zero it means that it could not run successfully and typically it has written an error message to STDERR (or STDOUT). You should somehow capture or print the output streams so you can inspect them for error messages. For example:

cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

Note also that your command line arguments should be separate array elements (instead of space separated elements in a single string as they are now):

cmd := exec.Command("web2exe-win.exe", "html-folder", "--main", "index.html", "--export-to", "windows-x32", "--output-dir")