Simple Batch File/Program/App please


Joined
Sep 5, 2016
Messages
106
Reaction score
9
I would like to have a simple batch file or program/app which simply sleeps my computer - nothing more - just run it and it sleeps. I had a look at Visual Studio Code but it is well beyond my capabilities. Is there some kind soul here who could put something up please?
 
Ad

Advertisements

Joined
May 6, 2015
Messages
2,512
Reaction score
398
Can you not write a simple script in Powershell? Using Visual Studio for something like that is certainly overkill.
 
Joined
Feb 22, 2014
Messages
1,442
Reaction score
291
These commands can be put in a command-line script.

http://superuser.com/questions/463646/is-there-a-command-line-tool-to-put-windows-8-to-sleep/463652#463652
Here are all of the power options, I hope you find these useful.

  • Shutdown:

    %windir%\System32\shutdown.exe -s

  • Reboot:

    %windir%\System32\shutdown.exe -r

  • Logoff:

    %windir%\System32\shutdown.exe -l

  • Standby (disable hibernation, execute the standby command, then re-enable hibernation after 2 seconds):

    powercfg -hibernate off && start /min "" %windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Standby && ping -n 3 127.0.0.1 && powercfg -hibernate on

  • Sleep (same method as STANDBY, but this command):

    %windir%\System32\rundll32.exe powrprof.dll,SetSuspendState 0,1,0

  • Hibernate:

    %windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Hibernate
 
Ad

Advertisements

Joined
Sep 5, 2016
Messages
106
Reaction score
9
Thanks. The sleep one seems to be what I want. However, it has "System32" in it. My machine is a 64 bit one.

Next step to explore is how to put that in a batch file (I think that is what is needed).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top