Is there a way to put a computer to sleep somehow other than clicking start, then sleep?

I am using a shortcut to this right now:
C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState 0,1,0

but it doesnt do the same thing as clicking "Sleep" in the start menu.

I need a piece of C++ code, vbs script, shortcut key, or any way to trigger sleep mode, or trigger the default power button function. Can anyone help?

after a long and extremely frustrating search, I found that the creating a shortcut to "C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState" ACUALLY IS the solution..except that I had to go into power management and disable hybrid sleep..I think that did it. But as I was so frustrated, I also found that running

powercfg.exe /hibernate off

removes the option from the power management menu completely.

Good Night :yawn:

edit-
for anyone who is on the same page as me, I also found an option to disable wake timers in there, and found that I could disable wake functions from the device manager device properties for all devices except my main keyboard. My computer would sometimes wake up 5 minutes after putting it to sleep...which was EXTREMELY inconvenient as my computer is not within arms reach of my bed(good thing it isnt:angry:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.