We’d like to remind Forumites to please avoid political debate on the Forum.

This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.

📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide

PC scheduling

245

Comments

  • closed
    closed Posts: 10,886 Forumite
    edited 14 April 2013 at 8:05AM
    what is the program you are trying to run

    are you saying that power saving settings no longer work at all, even if you don't touch the keyboard/mouse?

    to programatically hibernate or sleep:

    %SystemRoot%\System32\Rundll32.exe PowrProf,SetSuspendState Hibernate

    run powercfg -h off beforehand to sleep rather than hibernate.
    !!
    > . !!!! ----> .
  • JulyKnot
    JulyKnot Posts: 189 Forumite
    Hi,
    The program is no longer the issue. I managed to work all that side of things out and everything woke up and ran as desired this morning.
    What I can't seem to do is make the computer sleep in the evening via the power options ( ie nothing changed after the time set) so I have to manually go to start > sleep and that does it ok.
    I want to get it to sleep without me physically have to tell it to each evening.

    I'm afraid I need a bit more explanation ( ie step by step) re post 12's instructions if possible.
  • closed
    closed Posts: 10,886 Forumite
    edited 14 April 2013 at 9:08AM
    The instructions were in response to

    "How can I make the pc close the program and sleep at a particular time? Everything I have read so far just has commands for shutdown"

    create a batch file 1.bat

    thepathandprogramyouwanttorun.exe
    powercfg -h off (if you want to sleep rather than hibernate)
    %SystemRoot%\System32\Rundll32.exe PowrProf,SetSuspendState Hibernate

    save it as .bat not .txt
    double click on 1.bat


    if automatic powersaving is messed up, try a system restore
    !!
    > . !!!! ----> .
  • JulyKnot
    JulyKnot Posts: 189 Forumite
    Thanks.
    I have never created a batch file before but keen to learn. Where can I get guides I can read on this rather than pester helpful forum members?

    Is there any risk for a novice like me to make a big hash by playing around with this sort of stuff?
  • closed
    closed Posts: 10,886 Forumite
    depends what you do, google batch files, and backup if you are worried.
    !!
    > . !!!! ----> .
  • JulyKnot
    JulyKnot Posts: 189 Forumite
    edited 18 April 2013 at 7:48PM
    I am now trying to start at the simplest possible and ignore turning the program off and concentrate on just making the pc sleep at a particular time and creating a task in task scheduler.
    I googled around and found these instructions for a batch file:
    @echo off
    powercfg -h off
    rundll32.exe powrprof.dll,SetSuspendState 0,1,0
    powercfg -h on

    I tried it and set the schedule to run a minute or so later and the pc did more than just sleep- I guess hibernate?

    Would someone be kind enough to tell me what each bit does? ( I thought powercfg -h off was the bit that made it sleep) Or even give me adapted instructions to paste to just make the pc sleep.
    Thanks

    What is the difference between rundll32.exe powrprof.dll,SetSuspendState 0,1,0

    and closed's %SystemRoot%\System32\Rundll32.exe PowrProf,SetSuspendState Hibernate
  • closed
    closed Posts: 10,886 Forumite
    edited 18 April 2013 at 8:04PM
    powercfg off or on disables/enables the hibernation file (if there is no hibernation file, it should sleep instead)

    echo off does nothing other than stop the batch file commands coming on screen

    rundll command sleeps or hibernates depending if hibernation is enabled

    have you tried running it manually? add the word pause (on a new line) after the 1st powercfg before running manually, then you can see if it actually deletes the hibernation file. - remove the pause afterwards

    and if it doesn't work, right click, run as administrator (powercfg needs to be run as admin)

    there is no difference, they both do the same thing.
    !!
    > . !!!! ----> .
  • JulyKnot
    JulyKnot Posts: 189 Forumite
    I'm getting in a bit of a pickle.
    Looking at your question, have I run it manually, I assumed you meant double click the .bat file.

    I seem to recall getting a message saying I do not have permission for something ( I think the word hibernate was in there) and then the picture went blank and had to force a shutdown. Not good.
    So back to basics.
  • JulyKnot
    JulyKnot Posts: 189 Forumite
    edited 18 April 2013 at 8:14PM
    Looks like I need to see the commands so best remove the echo off bit?

    I had best try and find out if hibernation is enabled. Where do I look? Power options?
  • closed
    closed Posts: 10,886 Forumite
    remove the echo off

    add the pause

    add another pause at the end

    right click the bat file, run as administrator

    pause makes it prompt for a keypress before continuing
    !!
    > . !!!! ----> .
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 353.5K Banking & Borrowing
  • 254.1K Reduce Debt & Boost Income
  • 455K Spending & Discounts
  • 246.5K Work, Benefits & Business
  • 602.9K Mortgages, Homes & Bills
  • 178K Life & Family
  • 260.5K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16K Discuss & Feedback
  • 37.7K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.