LPM: Running system() on a WinNT box
Gregg Casillo
gcasillo at ket.org
Fri Dec 22 11:40:00 CST 2000
While Wesley's approach would work, I'm trying to move away from batch
files as much as possible and indulge Perl as much as possible. We have
several old Perl scripts on our servers that were converted to batch
files. I mean dirt old. They're bothersome to maintain, because, well,
they're DOS batch files as much as they are Perl scripts.
A few notes about my previous problem executing Windows NT at scheduler
with a system() call. First, I found a module on CPAN, Scheduler::At,
that has the interface and functionality I need except that it is biased
toward *nix systems. I could modify that to work with WinNT's at
scheduler, but I decided to hold off on that idea. I continued to work
with the system() call and finally got it working with some inspiration
from perlmonks.org. Then I found that I wanted the ID number of the at
job I created. So I finally settled on a code snippet that you can find
in the Perl Cookbook (16.4 Reading or Writing to Another Program). I can
execute Windows NT's at scheduler with parameters and collect the output
from that program which includes the job ID number that I can use later.
Viola, right? Well, yes from the Perl side of the ledger, but Windows
NT's at scheduler or command line appears to limit the amount of
characters you can use to 259 characters or so.
So I'm running but with my feet chopped off.
Happy Holidays,
Gregg Casillo
Rich Bowen wrote:
> Wesley wrote:
>
>> How does this sound: if the command to create the at job is static, put
>> all the nasty stuff in a regular batch file, then use perl's system to
>> run the batch file. If the guts of the command can change, then write
>> the command out to a batch file and use system() to run the dynamically
>> created batch file. That way the batch file can have exactly the
>> characters in it that at and Windows want it to have, without having to
>> indulge Perl as well. HTH.
>
>
> There's also a bizarre tool that used to come with ActivePerl that would
> turn a perl program into a batch file. Or it might have been the other
> way around.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/archives/lexington-pm/attachments/20001222/86b7d9b6/attachment.htm
More information about the Lexington-pm
mailing list