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

I am trying to call a perl file (w3.pl) repeatedly after every minute by double clicking in BATCH FILE (final.bat)

My try to do is below. It runs once fine but never repeats after every 1 minute. How to make it repeat after every 1 minute ?

schtasks /create /tn "batch Script" /tr C:\shekhar_Axestrack_Intern\Wi +ndowCreation\final.bat /sc minute /mo 1 perl C:\shekhar_Axestrack_Intern\WindowCreation\w3.pl
  • Comment on how to call this perl file repeatedly after every minute from batck file
  • Download Code

Replies are listed 'Best First'.
Re: how to call this perl file repeatedly after every minute from batck file
by Corion (Patriarch) on Jan 13, 2015 at 19:18 UTC

    Why do in a batch file what you can do in a(nother) Perl program?

    while (1) { system($^X, '0w3.pl') == 0 or warn "Couldn't launch w3.pl: $! / $^E"; sleep 60; };
Re: how to call this perl file repeatedly after every minute from batck file
by GotToBTru (Prior) on Jan 13, 2015 at 22:13 UTC

    Not a Perl question, is it? You just need to get the syntax of the schtasks program right.

    Dum Spiro Spero
Re: how to call this perl file repeatedly after every minute from batck file
by jonadab (Parson) on Jan 14, 2015 at 12:56 UTC

    Yet another way to do it: have the batch file call itself after one minute:

    perl w3.pl perl -e ' sleep 1; ' final.bat

    This is closer to what you actually asked for. With that said, this isn't what I'd do, if it were me. Corion's approach is closer to what I would do, if it were me.