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";}
====================================