Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista General Discussion > Will computer sleep while batch file is running?

Reply
Thread Tools Display Modes

Will computer sleep while batch file is running?

 
 
hannaxbear
Guest
Posts: n/a

 
      08-15-2008

I'm trying to set up a batch file that will defragment my computer,
create a time log when it finishes, and then shutdown. I'm wondering if
my laptop will go to sleep during this process since it is set to sleep
after 15 minutes of being idle when plugged in. If so, how can I prevent
this so that the batch file can complete? This is my code so far and I'm
running on Vista:

@ECHO OFF
REM Defrag C: drive, with full defrag and forced in nec.
START "" /WAIT %SystemRoot%\SYSTEM32\DEFRAG C: -W -F
REM Creating log file of time.
ECHO. |TIME > TIME
COPY LOG +TIME
REM Now shut down, forcing apps closed if necessary
START "" /WAIT %SystemRoot%\SYSTEM32\SHUTDOWN /S /F
:END

(If something doesn't seem right in the code, please let me know).

Thanks in advance!


--
hannaxbear
------------------------------------------------------------------------
hannaxbear's Profile: http://forums.techarena.in/members/hannaxbear.htm
View this thread: http://forums.techarena.in/vista-help/1021113.htm

http://forums.techarena.in

 
Reply With Quote
 
 
 
 
Mark L. Ferguson
Guest
Posts: n/a

 
      08-15-2008
Rather than doing the shutdown from a script, set the system to do a defrag
in a logoff script (.bat file).
Start/run, type GPEDIT.MSC and set the bat file in the logoff script there.

--
Please use the Communities guidelines when posting.
http://www.microsoft.com/wn3/locales...help_en-us.htm
Use the "Ratings" feature. It helps the new users.
Mark L. Ferguson MS-MVP
https://mvp.support.microsoft.com/profile/Mark.Ferguson

"hannaxbear" <> wrote in message
news:...
>
> I'm trying to set up a batch file that will defragment my computer,
> create a time log when it finishes, and then shutdown. I'm wondering if
> my laptop will go to sleep during this process since it is set to sleep
> after 15 minutes of being idle when plugged in. If so, how can I prevent
> this so that the batch file can complete? This is my code so far and I'm
> running on Vista:
>
> @ECHO OFF
> REM Defrag C: drive, with full defrag and forced in nec.
> START "" /WAIT %SystemRoot%\SYSTEM32\DEFRAG C: -W -F
> REM Creating log file of time.
> ECHO. |TIME > TIME
> COPY LOG +TIME
> REM Now shut down, forcing apps closed if necessary
> START "" /WAIT %SystemRoot%\SYSTEM32\SHUTDOWN /S /F
> :END
>
> (If something doesn't seem right in the code, please let me know).
>
> Thanks in advance!
>
>
> --
> hannaxbear
> ------------------------------------------------------------------------
> hannaxbear's Profile: http://forums.techarena.in/members/hannaxbear.htm
> View this thread: http://forums.techarena.in/vista-help/1021113.htm
>
> http://forums.techarena.in
>

 
Reply With Quote
 
hannaxbear
Guest
Posts: n/a

 
      08-17-2008

I've read about the GPedit.msc file already and I don't have it on my
computer (I think I'm probably running the Vista Home version so it
doesn't come with it after SP1).


--
hannaxbear
------------------------------------------------------------------------
hannaxbear's Profile: http://forums.techarena.in/members/hannaxbear.htm
View this thread: http://forums.techarena.in/vista-help/1021114.htm

http://forums.techarena.in

 
Reply With Quote
 
Paul Montgomery
Guest
Posts: n/a

 
      08-17-2008
On Aug 16, 10:42*pm, hannaxbear <hannaxbear.3e9...@DoNotSpam.com>
wrote:
> I've read about the GPedit.msc file already and I don't have it on my
> computer (I think I'm probably running the Vista Home version so it
> doesn't come with it after SP1).


It doesn't come with either Home Basic or Home Premium. I have no idea
why it was recommended without first asking you what version you have.
 
Reply With Quote
 
Mark L. Ferguson
Guest
Posts: n/a

 
      08-17-2008
You should look at taskschd.msc. Scheduling a defrag with a trigger of 'when
a user disconnects' might do your job on Home. If you change users a lot,
it might not be convenient to kill that task every time .

After you finish the defrag task, you get a checkbox to open the Properties,
where the Triggers tab, Edit button, drop box can be to set to 'when a user
disconnects from a session'

--
Please use the Communities guidelines when posting.
http://www.microsoft.com/wn3/locales...help_en-us.htm
Use the "Ratings" feature. It helps the new users.
Mark L. Ferguson MS-MVP
https://mvp.support.microsoft.com/profile/Mark.Ferguson

"hannaxbear" <> wrote in message
news:...
>
> I've read about the GPedit.msc file already and I don't have it on my
> computer (I think I'm probably running the Vista Home version so it
> doesn't come with it after SP1).
>
>
> --
> hannaxbear
> ------------------------------------------------------------------------
> hannaxbear's Profile: http://forums.techarena.in/members/hannaxbear.htm
> View this thread: http://forums.techarena.in/vista-help/1021114.htm
>
> http://forums.techarena.in
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Task Scheduler Returned Error 0x2 While Running Batch File lqd1967 Windows Vista Administration 0 06-09-2008 11:00 AM
Running batch files as administrator change working directory corradolab@ngi.it Windows Vista General Discussion 1 01-07-2008 02:41 PM
batch file calling exe file problem JPS Windows Vista Security 1 12-20-2007 12:18 AM
running batch files... maya Windows Vista General Discussion 12 08-23-2007 01:26 AM
Running Batch Files in VISTA Peeky Windows Vista General Discussion 8 06-24-2007 12:43 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59