Results 1 to 4 of 4

Thread: sending computer to sleep

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2013
    Posts
    3

    Post sending computer to sleep

    hi

    i have a vbs that after two hours sends my computer to shutdown. this is the script

    set shell = CreateObject("Wscript.Shell")

    shell.run "shutdown.exe -s -t 7200"

    i was wondering if there is any way i could change it to send my computer to sleep instead of shuting down?

    any help would be appreciated

    thanks

    michael

  2. #2
    Lively Member
    Join Date
    Dec 2010
    Location
    http://bbat.forumeiro.com/
    Posts
    86

    Lightbulb Re: sending computer to sleep

    Hi
    Try this code :
    Code:
    set shell = CreateObject("Wscript.Shell")
    Command = "Cmd /c rundll32.exe powrprof.dll,SetSuspendState hibernate"
    Hibernate = shell.run(Command,0,True)

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2013
    Posts
    3

    Re: sending computer to sleep

    hey thanks for the help is there anyway i can set a timer on this to have it activate after a certain amount of seconds

  4. #4
    Lively Member
    Join Date
    Dec 2010
    Location
    http://bbat.forumeiro.com/
    Posts
    86

    Lightbulb Re: sending computer to sleep

    How to Create Scheduled Task With VBScript : You can call the "Win32_ScheduledJob" class from a VBscript to manage and create scheduled tasks from a script. Using this class, you can specify the program you want to run, whether you want to run it interactively or in the background and the precise date and times you want it to run. You can schedule any type of task, from running a system task in the background to automatically opening a graphical Windows program.

Posting Permissions

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



Click Here to Expand Forum to Full Width