Launching script with batch file

I usually use a windows batch script to pass command line args to my perl scripts - It makes maintenance easier, and keeps the console from disappearing if the script crashes.
batch file:
Code Sample
rem launch.cmd
set maindir=C:/test
set files=20

perl -w c:\ %maindir% %files%


perl script:
Code Sample
$mainDir = shift @ARGV;
$files = shift @ARGV;

Is there an easy way to work with scripts this way by hitting F9 to execute the batch file in OptiPerl instead of adding the arguments to the script?

You could add a user tool (From Tools / User tools) to point to the bat file, assign a shortcut to it, and/or move it under the "Run" menu. See the help file ("User Tools" section) for more information.

Note that you can keep the console from disappearing from "Run / Prompt & run in console", and select "Leave console window open". Then "Run / Run in console" will also reflect the change.

02.03.2004. 18:46

This article hasn't been commented yet.

Write a comment




8 + 2 =