Results 1 to 2 of 2

Thread: [Windows 8.x] How to Create a Task to Wake up the Computer to Run

  1. #1
    Banned

    Join Date
    Feb 2012
    Posts
    2,361
    Thanks
    166
    Thanked 1,205 Times in 607 Posts
    Rep Power
    0
    Reputation
    16611

    Default [Windows 8.x] How to Create a Task to Wake up the Computer to Run

    This will show you how to create or modify an existing task in Windows's Task Scheduler so it will wake up the computer from a hybrid-sleep mode and run. This way you can have the task wake up the computer and run automatically for when it is convenient for you instead. Note that's assumed your computer always is put into hybrid-sleep mode, not a full shutdown has made.

    No changes are made to the UEFI/BIOS settings.


    IMPORTANT: Before you continue reading, you have to run "powercfg" utility on your Windows 8.x computer to make sure that hybrid-sleep (power state S3) indeed is supported by your Windows 8.x computer.

    The following command should be run in Command Prompt (cmd.exe) with Administrative privileges.

    powercfg.exe -a

    You should get an output similar this one:
    Code:
    The following sleep states are available on this system:
        Standby ( S3 ) Hibernate Hybrid Sleep
    The following sleep states are not available on this system:
    Standby (S1)
        The system firmware does not support this standby state.
    Standby (S2)
        The system firmware does not support this standby state.
    If hybrid-sleep (S3) isn't supported, this how-to probably isn't for you, unless you enable hybrid-sleep on your computer:
    Control Panel > Power Options > Edit Plan Settings > Change Advanced Power Settings > Sleep > Allow Hybrid Sleep


    HOW TO:

    » Open Task Scheduler in Windows 8 & 8.1

    In both Windows 8 and Windows 8.1, go to "Control Panel -> System and Security -> Administrative Tools -> Task Scheduler". The Task Scheduler window is now opened.

    If you are prompted for an administrator password or confirmation, type the password or provide confirmation.

    » Create a Basic Task Wizard

    In the Task Scheduler window, go to the Actions column on the right. There, click "Create Basic Task" to open the "Create Basic Task Wizard". As the name implies, this wizard allows anyone to create basic tasks that are executed by Windows, at a given time or when a certain condition is met.
    Type a name for the task and an optional description, and then click or tap Next.

    » Choose When Your Task is Executed

    The two key concepts involved in scheduling a task are triggers and actions. A trigger causes a task to run and an action is the work that is performed when the task is run. The actions a task can perform include running a program, sending an e-mail message, and showing a message box. For example, you can send an e-mail when a certain event entry is logged in the event log or run a maintenance script when a user logs on to a computer. Occurrences that can trigger a task to run include: a computer starting up, a computer entering an idle state, or a user unlocking a workstation. In addition, you can schedule a task to run at a specified time.

    Pick the "Daily" option and then click or tap Next.

    » Set what Action to Execute

    The next step is to indicate the action to take. Here you will find an important difference between Windows 7 and Windows 8 or 8.1. In Windows 8 or 8.1 only option "Start a program" is applicable.
    Select "Start a program" and then click or tap Next.

    NOTE: In our case we simply run a Windows Command Script stored in file named "PutComputerIntoSleepMode.cmd" with content such as the following

    @echo off
    :: define hour of day when to put computer into hybrid-sleep mode
    set /A endHours = 23
    :: start test loop
    :loop
    :: get current time
    for /f "tokens=1-8 delims=.:/-, " %%i in ('echo exit^|cmd /q /k"prompt $D $T"') do (
    for /f "tokens=2-4 delims=/-,() skip=1" %%a in ('echo.^|date') do (
    set dow=%%i
    set mm=%%j
    set dd=%%k
    set yy=%%l
    set /A hh=%%m
    set min=%%n
    set sec=%%o
    set hsec=%%p
    )
    )
    :: compare hours
    if %hh% GEQ %endHours%
    (
    :: put computer into hybrid-sleep mode
    shutdown.exe /s /hybrid /t 0
    exit
    )
    :: wait half an hour
    timeout 1800 /nobreak
    :: do next test
    goto loop

    which peferrredly is located in folder \Windows\MyCommands


    Click or tap Browse, select the program or the script you want to run and then press Open.

    » Set up the Task Conditions

    To set them, click or tap the Conditions tab.

    Because your computer is in hybrid-sleep mode and it is the time to run the task, under Power you set the computer to wake up and run the task.

    » Done

    Then, you are shown a summary of the task and the settings you have made. Click or tap the Back button if you want to change anything or the Finish button if you want to save the task and have it run.


    Appendix:

    Last edited by jwoegerbauer; 08-07-14 at 02:21 AM. Reason: DOS code revised



Look Here ->
  • #2
    Senior Member

    Join Date
    Mar 2008
    Posts
    1,265
    Thanks
    139
    Thanked 643 Times in 368 Posts
    Rep Power
    454
    Reputation
    10815

    Default

    A tip when running tasks via Task Scheduler - the task priority. By default Windows Vista / 7 / 8 (and server versions of) all default to creating tasks with priority 7 - ie idle class. This may not cause problems CPU wise but it may well cause problems disk IO wise if the task does a lot of time sensitive writing and something else is doing a lot of disk access.

    If this is a problem, after completing the steps above, export the task to a .xml file, edit the file with notepad, location the <Priority> tag and change the default value from 7 to say 4. Delete the task and import it again.

  • Bookmarks

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •