[Win32utils-devel] Implementing a TaskScheduler#exists? method

Luis Lavena luislavena at gmail.com
Tue Jun 16 23:54:42 EDT 2009

On Wed, Jun 17, 2009 at 12:15 AM, Daniel Berger<djberg96 at gmail.com> wrote:
>> -----Original Message-----
>> [...]
>> I think the best way to check taskscheduler item is just go to the
>> Scheduled Tasks folder (in most case c:\winodws\tasks) and see the
>> .job files.
>> You can write it with ruby like this:
>> def TaskScheduler#exists?(work_item)
>>   File.exist?("#{ENV['windir']}\\Tasks\\#{work_item}.job")
>> end
> That will work, though I don't think it's a requirement that the .job file
> live there, is it?

Well, on Windows 7 and Vista only list 2 job files for me, and are
google related.

On Windows 7 there is SchTasks which list *lot* of tasks not covered
by Windows\Tasks folder.

>> BTW, Do you mind I write pure ruby taskscheduler?
> I don't mind so long as you're not using WMI. I never completed that because
> of the restrictions.

I believe there is an API not using instrumentation services, but
quite don't remember. A partner at my old job used to play with it on
Windows 2000. Will check and get back to you.

Luis Lavena
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

More information about the win32utils-devel mailing list