请教大佬golang怎么执行windows平台的dos命令,并等待输出所有日志。
```
package main
import (
"context"
"fmt"
"os/exec"
)
func main() {
ctx := context.Background()
cmd := exec.CommandContext(ctx, "cmd", "/C", `dir`)
fmt.Println(cmd.CombinedOutput())
}
```
#3
更多评论