Running perl script from command line

  • Thread starter Abhishek Srivastava
  • Start date
A

Abhishek Srivastava

Hello All,

I am using active state perl on windows xp. I keep all my perl scripts
in a directory called "c:\myapps\perl\" I have put this directory into
my system PATH.

now to run these scripts I want to go to the console and say

myscript.pl a b c [here a b c are the parameters to the script]

I have also assosiated *.pl extension with c:\perl\bin\perl.exe (using
windows explorer file->folder options)

When I run my script something strange happens, the script is run but
none of the command line parameters are passed to it.

Why are the command line params not being passed to my script?

I am sure someone would have tried this out if you use perl on a
windows machine.

Thanks a lot for your help.

regards,
Abhishek.
 
K

ko

Abhishek said:
Hello All,

I am using active state perl on windows xp. I keep all my perl scripts
in a directory called "c:\myapps\perl\" I have put this directory into
my system PATH.

now to run these scripts I want to go to the console and say

myscript.pl a b c [here a b c are the parameters to the script]

I have also assosiated *.pl extension with c:\perl\bin\perl.exe (using
windows explorer file->folder options)

Its easiest to let the install program create the file association...
When I run my script something strange happens, the script is run but
none of the command line parameters are passed to it.

Why are the command line params not being passed to my script?

I am sure someone would have tried this out if you use perl on a
windows machine.

Thanks a lot for your help.

regards,
Abhishek.

In the HTML documentation that comes with AS:

ActivePerl FAQ->Windows Specific->Windows NT/2000 and Windows 9x, the
'How do I associate Perl scripts with perl?' section.

HTH - keith
 
J

James Willmore

On Thu, 05 Feb 2004 00:47:02 -0800, Abhishek Srivastava wrote:

When I run my script something strange happens, the script is run but
none of the command line parameters are passed to it.

Why are the command line params not being passed to my script?
<snip>

Code would be helpful :)

*How* are you parsing the command line options in your script?

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
Honesty pays, but it doesn't seem to pay enough to suit some
<people. -- F. M. Hubbard
 
M

Michele Dondi

myscript.pl a b c [here a b c are the parameters to the script]

I have also assosiated *.pl extension with c:\perl\bin\perl.exe (using
windows explorer file->folder options)

When I run my script something strange happens, the script is run but
none of the command line parameters are passed to it.

First of all AS Perl comes with extensive documentation that covers
*also* these issues. But how can you tell that cmd line params are not
passed to the script? What does

perl -le "print for @ARGV" <args>

yield? And if you put this code in a file, say myprog.pl, what does

myprog.pl <args>

yield?


Michele
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top