Executable files not in path - GO

Viewed 2949

I'm trying to call a built in command for the command prompt and I'm getting errors I don't understand.

func main() {
    cmd := exec.Command("del", "C:\trial\now.txt")
// Reboot if needed
    cmd.Stdout = os.Stdout
    if err := cmd.Run(); err != nil {
        log.Fatal(err)
    }
}

And I'm getting the following error:

exec: "del": executable file not found in %PATH%
exit status 1

What am I doing wrong?

2 Answers
Related