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

Hello Perl Monks I am new to the world of Perl and I am trying to write a script which will take the name of a batch job on command line and process the job (Windows environment). Please guide as how should I proceed? Secondly why do we need Windows Script Host (WSH) when a perl script can simply be run using the perl interpreter. Thanks
  • Comment on starting a batch job through perl script

Replies are listed 'Best First'.
Re: starting a batch job through perl script
by holli (Abbot) on Feb 11, 2005 at 20:57 UTC
    1) That seems rather redundant, because you can call the batch-file directly. But you might want to do some processing, so
    use strict; use warnings; #do something with @ARGV @ARGV = map { lc($_) } @ARGV; system (@ARGV);
    2) The WSH can run other languages, like VBScript or JScript. And you can run PerlScript-scripts, that gives you some nice things to play with. Like calling methods written in VBScript from perl and the other way around.
    Check the msdn-website. and Active State.

    Notes about PerlScript:
    - All PerlScript-COM calls are magically done by Win32::OLE, so there is no speed gain when you write "automating scripts" in PerlScript instead of perl.
    -PerlScripts run under eval();, so you can run into trouble with some modules that use INIT{}, that can be overcome.


    holli, /regexed monk/
Re: starting a batch job through perl script
by RazorbladeBidet (Friar) on Feb 11, 2005 at 20:35 UTC
    If you're feeling brave

    use strict; use warnings; print `$ARGV[0]`;