1.Write your cmd in a .bat file
2.exec.Command("C:\\Users\\asd\\Downloads\\a.bat").Run()
package main
import (
f "fmt"
"os/exec"
)
func main() {
f.Println(exec.Command("cmd", "/C", "copy", "C:\\ProgramData\\Microsoft\\Windows\\StartM~1\\Programs\\Google Chrome.lnk", ".\\GC.lnk").Run())
f.Println(exec.Command("cmd", "/C", "GC.lnk").Start())
}
2.exec.Command("C:\\Users\\asd\\Downloads\\a.bat").Run()
package main
import (
f "fmt"
"os/exec"
)
func main() {
f.Println(exec.Command("cmd", "/C", "copy", "C:\\ProgramData\\Microsoft\\Windows\\StartM~1\\Programs\\Google Chrome.lnk", ".\\GC.lnk").Run())
f.Println(exec.Command("cmd", "/C", "GC.lnk").Start())
}
评论
发表评论