请教大佬golang怎么执行windows平台的dos命令

dtbu · · 1796 次点击
``` package main import ( "context" "fmt" "os/exec" ) func main() { ctx := context.Background() cmd := exec.CommandContext(ctx, "cmd", "/C", `dir`) fmt.Println(cmd.CombinedOutput()) } ```
#3
更多评论
https://zhuanlan.zhihu.com/p/296409942
#2