I'm writing a function that will run an msi file by taking in the applications path as a parameter. Right now the function is returning an error code stating that the application's path is not a valid Win32 application. This function works for .exe files, but not .msi files. How can I refactor it to work for .msi files?
func Run(application string) {
cmd := exec.Command(application)
err := cmd.Run()
if err != nil {
log.Fatalf("cmd.Run() failed with %s
", err)
}
}
you can simply run it through windows's command line
func main(){
c := exec.Command("cmd", "/C", "msiexec /a \"pathtotheMSIfile\"")
if err := c.Run(); err != nil {
fmt.Println("Error: ", err)
}
}