Any examples of how to call PERL in windows scripting host

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
broswell
Posts: 7
Joined: Wed May 04, 2005 7:47 pm

Any examples of how to call PERL in windows scripting host

Post by broswell »

I have had good luck running perl programs from Linux. In Windows I seem to have to call a batch file to call the script instead of typing the script into the script manager. Has anyone conquered this?
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

If you have Perl installed and you see correct path to your perl interpreter in 1st line of the script (#!/usr/bin/perl), script should be started without special commands.
What exactly the problem (error message) do you see?

Regards
Alex
Yoorix
Posts: 177
Joined: Wed Dec 14, 2005 8:28 am

Post by Yoorix »

Unlike Linux, Perl is not installed by default on Windows. You have to install Active Perl first. After install you should call your script like this:
"D:\Perl\perl.exe script_name.pl"
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Sorry, I thought you are asking about Linux.
If you are using Windows and you have installed Perl script engine, you may use csript.exe (Windows Script Host) to execute scripts.

Regards
Alex
Yoorix
Posts: 177
Joined: Wed Dec 14, 2005 8:28 am

Post by Yoorix »

You have to include the folder, where perl was installed, into PATH environment variable. After that you can call "perl" and type your script there or run particular perl script directly.
broswell
Posts: 7
Joined: Wed May 04, 2005 7:47 pm

A full answer to my original question

Post by broswell »

The script command should should look like this

cmd /c cscript //B //E:PerlScript %Script% %Params%

the second trick is that there is a funky way to get the parameters back.
The usual ARGV variables don't work

This URL http://aspn.activestate.com/ASPN/docs/A ... tHost.html
provided the hint.

Seems to work with $arg->{1} for argument 1 Etc
Yoorix
Posts: 177
Joined: Wed Dec 14, 2005 8:28 am

Post by Yoorix »

I don't use Windows Script Host with perl. I use syntax: "perl.exe scropt_name.pl list_of_params". ARGV works like a charm. :D

It looks like this: "my $param_name = @ARGV[0];" etc.

In this case there is in no differrence between Linux and Windows perl engine.
Post Reply