Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This question already has an answer here:

I wanted to know how to standby (sleep) from command prompt for Windows XP. Using this CMD command C:\WINDOWS\System32\rundll32.exe PowrProf.dll,SetSuspendState 0,1,0 didn't work alone.

The only way I have found is to make a .bat file, then insert this code:

powercfg -h off
start /min "" C:\WINDOWS\System32\rundll32.exe PowrProf.dll,SetSuspendState 0,1,0
:: waiting 4 seconds for sleep
ping -n 4 127.0.0.1 > nul 
powercfg -h on
exit

...and whenever I open that file, the computer sleeps.

Is there an easier way to do this? I don't want external programs, just from cmd.

share|improve this question

marked as duplicate by Dave M, Shekhar, Scott, Breakthrough, Excellll Aug 2 '13 at 18:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Not a duplicate, but searching for a user, who needs the command line for sleep. The most of the sleep commands are triggered by the external programs, but in XP, there doesnt seem to be only one-line command. –  selnomeria-myopenid Aug 1 '13 at 11:56
    
Well I would see it as duplicate, as you would get the same answer as you can find that that question. –  Jesper Jensen Aug 1 '13 at 12:01
    
@JesperJensen : seems to me that the asker clearly states that the one-line solution (which is the one given in the question you link) doesn't work for him. –  Levans Aug 1 '13 at 12:08
    
@Levans It is also clearly stated in the duplicate topic and other answers has also been posted above. It's generally the same question, why should he get different answers? –  Jesper Jensen Aug 1 '13 at 12:19

1 Answer 1

up vote 0 down vote accepted

If you want to do it in “one line”, try

powercfg -h off & start /min "" C:\WINDOWS\System32\rundll32.exe PowrProf.dll,SetSuspendState 0,1,0 & ping -n 4 127.0.0.1 > nul & powercfg -h on

but I believe that the .bat file is easier.  :-)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.