in reply to Re: Win32::Taskscheduler failed to install on win7
in thread Win32::Taskscheduler failed to install on win7

The problem with both "AT" and "SCHTASKS" seems to be that they can only schedule Windows EXE or batch files to run and not Perl files.

Can someone verify if this is true.
Also, I gave up on CRONW with the number of dependencies it has. It is a pain to install.
  • Comment on Re^2: Win32::Taskscheduler failed to install on win7

Replies are listed 'Best First'.
Re^3: Win32::Taskscheduler failed to install on win7
by Corion (Patriarch) on Jul 27, 2011 at 08:20 UTC

    I would guess that they only schedule elements whose extension is listed in $ENV{PATHEXT}.

    It's not hard to create an "universal" Perl launcher:

    @echo off setlocal perl -w "%~dpn0.pl" %*

    Put this file as a .cmd right where your Perl script is:

    Directory of Q:\ 27.07.2011 10:18 50 tmp.cmd 27.07.2011 09:01 962 tmp.pl

    ... and you can run your Perl script without changing the extension.

    So far I haven't tested whether shell redirection works with this approach, so you still might need to modify PATHEXT for that.

    Update: I forgot to mention Schedule::Cron, which does duty as a cron replacement since about 8 years or so on Windows for me.

Re^3: Win32::Taskscheduler failed to install on win7
by BrowserUk (Patriarch) on Jul 27, 2011 at 08:31 UTC
    can only schedule ... batch files ... not Perl files

    So wrap the perl file in a batch file. Is it too complicated? How about two lines (and one's a comment! :)

    rem yourapp.bat \path\to\your\perl.exe \path\to\yourapp.pl %*

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Wow, some good suggestions there.

      Pardon my ignorance as I'm relatively new to this stuff.
      I notice that when the scheduler kickstarts my .pl file, It immediately ends with "End of Program".

      Surprisingly, even if I do this:
      C:\>perl C:\Perl64\bin\tap.pl End of program
      i.e. try to run by giving the absolute path from C:\ on my cmd prompt, it shows the same thing "End of Program".

      If I go to the directory containing tap.pl, however, i.e. (C:\Perl64\bin) and THEN run just tap.pl, it runs properly.

      Could someone clarify what's going on?
      Why does the script not run when I enter the Entire path? It doesn't run even if I do a "perl C:\Perl64\bin\tap.pl"

        Most likely, your program ("tap.pl") depends on getting launched with the current directory being C:\Perl64\bin. You could try to debug this by launching it with the full path from the directory:

        cd C:\Perl64\bin perl -w C:\Perl64\bin\tap.pl

        If the program expects to be launched from that directory, either change it or launch it from that direcctory.

Re^3: Win32::Taskscheduler failed to install on win7
by Anonymous Monk on Jul 27, 2011 at 08:20 UTC

    can only schedule Windows EXE or batch files to run and not Perl files.

    pl2bat makes perl files into batchfiles in a jiffy

    IIRC, I don't believe this is the case, like everything, it depends on ftype/assoc and pathext/path -- it is basically like double-clicking a file