Skip Menu |

This queue is for tickets about the Win32-TaskScheduler CPAN distribution.

Report information
The Basics
Id: 14053
Status: resolved
Priority: 0/
Queue: Win32-TaskScheduler

People
Owner: unicolet [...] netscape.net
Requestors: nygel.lyndley [...] uk.fujitsu.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.0.3
Fixed in: (no value)



Subject: quoting in $x->SetApplicationName();
HI, I'm having a problem with 2.0.3 which looks like it could be a bug. I want task scheduler to run the following command. "c:\program files\perl\bin\perl.exe" "c:\dir with spaces\test.pl" Simply pasting this into 'Run:' field in the task scheduler GUI does the trick. The perl executable prefix is required as .pl files aren't neccasarily associated to the perl executable, often they're associated to text editors. The problem is providing the above through the task::scheduler module, the following code attempts to do this and runs but the 'Run:' field when viewed subsequently is missing quotes which then causes the task not to run. ================================ #!perl use strict; use Win32::TaskScheduler; my $scheduler = Win32::TaskScheduler->New(); my $minutesAhead=10; my %trig=('BeginYear' => '2006','BeginMonth' => '3','BeginDay' => '10','StartHour' => '16', 'StartMinute' => '30','TriggerType' => $scheduler->TASK_TIME_TRIGGER_ONCE,'Type'=>{},); $scheduler->NewWorkItem('bug test',\%trig); $scheduler->SetApplicationName("\"c:\\program files\\perl\\bin\\perl.exe\" \"c:\\dir with spaces\\test.pl\""); $scheduler->SetWorkingDirectory("\"c:\\dir with spaces\\\""); $scheduler->SetAccountInformation("<user>","<pass>"); $scheduler->SetFlags($scheduler->TASK_FLAG_DELETE_WHEN_DONE); if($scheduler->Save()) {print "job set\n";}else {print "job set\n";} ====================================
As shown in this example: http://taskscheduler.sourceforge.net/examples/chuck.pl You are not using the api correctly. You must set the application to perl.exe and the args to the script. Use quotes-escaping to get the spaces in file/directory names correctly evaluated. Regards, Umberto [guest - Mon Aug 8 08:03:22 2005]: Show quoted text
> HI, > > I'm having a problem with 2.0.3 which looks like it could be a bug. > > I want task scheduler to run the following command. > > "c:\program files\perl\bin\perl.exe" "c:\dir with spaces\test.pl" > > Simply pasting this into 'Run:' field in the task scheduler GUI does > the trick. The perl executable prefix is required as .pl files > aren't neccasarily associated to the perl executable, often they're > associated to text editors. > > The problem is providing the above through the task::scheduler module, > the following code attempts to do this and runs but the 'Run:' > field when viewed subsequently is missing quotes which then causes > the task not to run. > > ================================ > #!perl > > use strict; > use Win32::TaskScheduler; > > my $scheduler = Win32::TaskScheduler->New(); > > my $minutesAhead=10; > my %trig=('BeginYear' => '2006','BeginMonth' => '3','BeginDay' => > '10','StartHour' => '16', 'StartMinute' => '30','TriggerType' => > $scheduler->TASK_TIME_TRIGGER_ONCE,'Type'=>{},); > > $scheduler->NewWorkItem('bug test',\%trig); > $scheduler->SetApplicationName("\"c:\\program > files\\perl\\bin\\perl.exe\" \"c:\\dir with spaces\\test.pl\""); > $scheduler->SetWorkingDirectory("\"c:\\dir with spaces\\\""); > $scheduler->SetAccountInformation("<user>","<pass>"); > $scheduler->SetFlags($scheduler->TASK_FLAG_DELETE_WHEN_DONE); > > if($scheduler->Save()) {print "job set\n";}else {print "job set\n";} > > ====================================