Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Win32::Taskscheduler failed to install on win7

by BrowserUk (Patriarch)
on Jul 26, 2011 at 13:38 UTC ( [id://916772]=note: print w/replies, xml ) Need Help??


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

Is there any other simple way to schedule your script execution on a windows machine?

Have you look at:

>SCHTASKS /? SCHTASKS /parameter [arguments] Description: Enables an administrator to create, delete, query, change, run and end scheduled tasks on a local or remote system. Parameter List: /Create Creates a new scheduled task. /Delete Deletes the scheduled task(s). /Query Displays all scheduled tasks. /Change Changes the properties of scheduled task. /Run Runs the scheduled task immediately. /End Stops the currently running scheduled task. /? Displays this help message.

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.

Replies are listed 'Best First'.
Re^2: Win32::Taskscheduler failed to install on win7
by mkhan (Sexton) on Jul 27, 2011 at 08:11 UTC
    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.

      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.

      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"

      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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://916772]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-03-28 23:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found