Hi guys,
I want to execute shutdown command from golang on Windows Server 2008. The command work from cmd but from the code simply do nothing and exit with some error code 1. The program run with Administrator rights.
_, err := exec.Command("C:\\Windows\\System32\\shutdown.exe","/s /f /d p:4:1").Output()
if err != nil {
fmt.Println(err)
}
Otherwise, the same code on W7 work (without /f /d p:4:1 which is only for Windows Server)
_, err := exec.Command("C:\\Windows\\System32\\shutdown.exe","/s").Output()
Does anyone have any idea? Thanks.