echo.bat
ECHO %1
main.go
package main
import (
"fmt"
"log"
"bytes"
"os/exec"
)
func main(){
var out bytes.Buffer
//要写绝对路径 D:\51cto_course\51ctowkxz\51cto_video_download_20210110\video_ts_file\decode.bat
cmd := exec.Command("cmd.exe", "/C", `D:\51cto_course\51ctowkxz\51cto_video_download_20210110\video_ts_file\echo.bat`, "qqq")
cmd.Stdout = &out
err := cmd.Run()
if err != nil {
log.Println(err)
return
}
fmt.Printf("%s", out.String())
}
参考
https://ask.csdn.net/questions/1042338
版权声明:本文为beyond706原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。