Task Scheduler

M

Mark

Is there a way to set up a task so that it runs once a day? I set up a task
to run at 6:00 A.M. daily, but if I'm not using the computer at that time
the task doesn't run when I do turn the computer on. In Vista there's an
option to run the task as soon as possible if a scheduled start is missed.

Thanks
Mark
 
P

Pegasus \(MVP\)

Mark said:
Is there a way to set up a task so that it runs once a day? I set up a
task to run at 6:00 A.M. daily, but if I'm not using the computer at that
time the task doesn't run when I do turn the computer on. In Vista there's
an option to run the task as soon as possible if a scheduled start is
missed.

Thanks
Mark

You could invoke a batch file via the Task Scheduler once
every 10 minutes. It would run schtasks.exe to check if your
task had run today, and if it had not, launch it right now.

Post again if you require more details.
 
M

Mark

Can you explain how to set up and run this batch file? The program I want to
run is "SysRestorePoint.exe". Every 30 minutes is probably sufficient.

Thanks
 
P

Pegasus \(MVP\)

Mark said:
Can you explain how to set up and run this batch file? The program I want
to run is "SysRestorePoint.exe". Every 30 minutes is probably sufficient.

Thanks

I changed my mind: Rather than checking the time when the
task ran last time round, I'm now using a semaphore file. This
approach requires much less code.

Copy & past the code below into a batch file of your choice,
fix up the wrapped lines, remove the line numbers and set
the correct path for your application in Line 07. Now use
the Task Scheduler to run this batch file once every 30 minutes.
You will find that SysRestorePoint.exe will run just once
every day.

01. @echo off
02. set LogDir=c:\Logs
03. set LogFile=%LogDir%\Semaphore.txt
04. if not exist "%LogDir%" md "%LogDir%"
05. robocopy /L /MinAge:1 "%LogDir%" c:\ *.* | find /i "new file" || goto
:eof
06. echo Application last run on %Date% at %Time% > "%LogFile%"
07. "c:\Program Files\Your App\SysRestorePoint.exe"

You can download robocopy.exe from the Windows
Resource Kit.
 
M

Mark

Should it look like this? I downloaded robycopy gui, not sure what to do
with. I saved as .bat. I don't think I did it right because when I clicked
on the file the program didn't run. This may be over my head.

Thanks

@echo off
set LogDir=c:\Logs
set LogFile=%LogDir%\Semaphore.txt
if not exist "%LogDir%" md "%LogDir%"
robocopy /L /MinAge:1 "%LogDir%" c:\ *.* | find /i "new file" || goto

echo Application last run on %Date% at %Time% > "%LogFile%"
"C:\Documents and Settings\Mark\Desktop\SysRestorePoint.exe"
 
P

Pegasus \(MVP\)

My Line #5 ended like so:
|| goto :eof but you turned it into this:
|| goto
Something missing there . . .

You need the Command Line version of robocopy.exe.
Put it into c:\Windows.
 
M

Mark

That got messed up when I was going down the line deleting the numbers, but
that's fixed now. My program didn't run, but could that be because I
already ran the program manually? Also I downloaded the Windows Resource
Kit, but not sure what to do with it.

Thanks
Mark
 
P

Pegasus \(MVP\)

You install the kit, then you it's probably best to copy
robocopy.exe from c:\program files\windows resource kit\...
to c:\windows.

You must, of course, make sure that ALL components
are in place. If you run the batch file without having robocopy.exe
in place then it will fail.

To test the program, don't run it from the Start / Run box.
If you do then you deprive yourself of all messages that
the program might give you! Open a Command Prompt
by clicking Start / Run / cmd {OK}, then run the batch
file from this black screen.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top