Blue_eyed_son has asked for the wisdom of the Perl Monks concerning the following question:

So I have Windows, and I've got a script that checks my library account, and I'd like to run at startup to tell me if I've got anything that's been recalled.

Does anyone know how I get the script to run at startup? If I just put the script in the startup folder, it just opens in a text editor, but it doesn't run.

Thanks!

Replies are listed 'Best First'.
Re: run perl script at startup
by marto (Cardinal) on Oct 04, 2005 at 15:45 UTC
    Hi,

    Are you calling it like "perl.exe myscript.pl" from start up?
    You could do that as a (windows) short cut I think.
    This assumes your paths are set properly.
    On the other hand you could could create the run at start registry key to do it.
    The keys concerned are listed here.

    Hope this helps.

    Martin
Re: run perl script at startup
by sauoq (Abbot) on Oct 04, 2005 at 15:45 UTC

    Sounds like maybe the .pl extension (or whatever you are using) just isn't associated with the perl interpreter?

    -sauoq
    "My two cents aren't worth a dime.";
    
Re: run perl script at startup
by blazar (Canon) on Oct 04, 2005 at 15:49 UTC
    I think that the under (at least) cmd.exe setting the .pl association appropriately will do. More portable would be a shortcut pointing to "wperl.exe myscript.pl" or even "C:\path\to\wperl.exe myscript.pl". I say "wperl" because that binary won't open a terminal, which would be mostly annoying.

    Update: I just realized you didn't include info about whether your script is GUI based or not. In the latter case you don't want wperl.exe; in the former you probably do...

Re: run perl script at startup
by spiritway (Vicar) on Oct 05, 2005 at 05:46 UTC

    Do your Perl scripts (files ending in .pl) show some sort of perlish icon when you list them using Windows Explorer? If not - if you get the generic icon, instead of something unique, then chances are you don't have that extension associated with Perl.

    To do this you'll need to go into Windows Explorer, select the Tools menu, and then select "Folder Options...". When you've got that dialog box up, choose the "File Types" tab. Search for the file extension ".pl". Most likely you won't find it. If you don't, then select the "New" button and create that association. You'll need to know where perl lives on the computer, in order to enter the path here. Once you've got your extensions associated with perl, then you should be able to run your scripts from startup.

    Just wondering - did you install your perl using Activestate's distribution? That should have made all your associations for you, unless somehow you decided not to allow this. If you installed perl yourself, you might want to consider using the Activestate distribution, because it has some useful conveniences like the perl package manager (ppm).

      Just wondering - did you install your perl using Activestate's distribution? That should have made all your associations for you, unless somehow you decided not to allow this.
      Also, it includes detailed instructions on how to set up associations correctly, in case you didn't allow it to do that in the first place or to set up additional ones. I remember having done so to associate '.wpl' to wperl.exe (for pTk scripts).