I got a Razer keyboard with programmable macro keys and I made a bat file to put the pc to sleep. The bat file works fine when I launch it in windows, but shuts down the pc when called from a programmed macro key.
rundll32.exe powrprof.dll,SetSuspendState 0,1,0
This seems too difficult.