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

Daniel Berger djberg96 at gmail.com
Tue Jun 16 23:15:18 EDT 2009



> -----Original Message-----
> From: win32utils-devel-bounces at rubyforge.org [mailto:win32utils-devel-
> bounces at rubyforge.org] On Behalf Of Heesob Park
> Sent: Tuesday, June 16, 2009 7:47 PM
> To: Development and ideas for win32utils projects
> Subject: Re: [Win32utils-devel] Implementing a TaskScheduler#exists?
> method
> 
> Hi,
> 
> 2009/6/17 Daniel Berger <djberg96 at gmail.com>:
> > Hi,
> >
> > I'd like to add TaskScheduler#exists?(work_item) to the win32-
> taskscheduler
> > library. Mostly I want it for testing, but it might come in handy for
> other
> > people as well.
> >
> > What's the best way to approach this? Just enumerate the tasks, and
> check
> > for the name?
> >
> 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?
 
> 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.

Regards,

Dan



More information about the win32utils-devel mailing list