I got the same error as you.
But dystroy is correct: You can’t run del or any other command built into cmd because there is no del.exe file (or any other del-executable for that matter).
I got it to work with:
package main
import(
"fmt"
"os/exec"
)
func main() {
var c *exec.Cmd
switch runtime.GOOS{
case "windows":
c = exec.Command("cmd", "/C", "del", "D:\\a.txt")
default://Mac & Linux
c = exec.Command("rm", "-f", "/d/a.txt")
}
if err := c.Run(); err != nil {
fmt.Println("Error: ", err)
}
}