13

I have installed ActivePerl on my Windows OS. I have followed below URL procedure to install

ActivePerl Installation

After having done that, I have tried to run "perl -v " on the command line. But it reports the following error.

The system cannot execute the specified program

What do I need to do to solve these issues?

3
  • Providing your operating system, whether it's 32 bit or 64, and exactly which package, zip, msi and platform would be useful. Commented Jun 16, 2010 at 11:15
  • If you can't resolve the Active Perl problems, you might try Strawberry Perl.
    – dsolimano
    Commented Jun 16, 2010 at 16:02
  • Does it really says "prgoram"?
    – dolmen
    Commented Jun 17, 2010 at 16:32

7 Answers 7

13

I was facing a similar issue... but the thing was that I could execute the file by right clicking the file and opening it with perl command line interpreter.... but still the perl-v command would give the error... all I had to do was execute this command

set PATH=C:\Perl\bin;%PATH%

This solved the issue...

1
  • Which must be executed how often? Commented Jun 22, 2017 at 21:30
11

You need to make sure the directory where the Perl executable lives (it might be C:\perl\bin, but basically wherever you told ActiveState Perl to be installed) is in your PATH environmental variable (you can find the variable value by typing set PATH command on command line prompt in Windows).

If you're not sure where you installed Perl to (and can't find it in the default C:\perl\bin), you can find the directory by going to Start menu, finding ActiveState Perl folder, and right-clicking on "Perl Package Manager" icon, then pick "Properties" from the right-click menu. Properties window (in the "Shortcut" tab) will have a "Target" line showing the directory.

2
  • Nothing comes up when i do a search for perl. What if I dont have perl\bin? What if my start menu doenst have "active state perl"? in the search anywhere
    – Tom
    Commented Aug 4, 2016 at 23:57
  • @Tom - use Windows file search. IIRC, "F3" in main desktop? or file search in start menu or file explorer.
    – DVK
    Commented Aug 5, 2016 at 1:06
7

I was getting a similar error after installing ActiveState Perl on Windows 8 x64 bit edition and trying to invoke 'perl' at the command line.

'perl' is not recognized as an internal or external command, operable program or batch file.

I remember selecting the option during installation to add the Perl directory to the system PATH environment, and after checking the system properties, it was indeed showing in the system PATH.

I tried installing 'Microsoft Visual C++ 2008 x86 and x64 redistributable setup' files as suggested by a few places but it still did not resolve the issue, until I tried some of the suggestions in this thread.

At the command prompt I entered:

set PATH

And surprisingly it did not list the Perl directories as being included in the PATH variables.

So to remedy that I entered this into the command prompt and hit enter:

set PATH=C:\Perl64\bin;C:\Perl64\site\bin;%PATH%

(The directory paths are for the 64 bit edition of Perl, adjust according to your installation) the %PATH% portion is important and ensures your existing settings are kept and not wiped out and overwritten when you set the PATH.

That fixed it and entering 'perl -v' into command prompt successfully replies your Perl version. If you had a PowerShell window open before setting the PATH variable, you will need to close it and re-open another instance of PowerShell.

I believe the original underlying issue was something to do with different PATH variables for 32-bit and 64-bit environments and possibly some internal Windows redirection that takes place automatically.

1
  • thanks a lot when run system('prove') under Dwimperl Windows7, not find program use FindBin '$RealBin'; system ('set PATH=c:\Dwimperl\perl\bin;%PATH%'); my $cmd= qq{prove --rc=.proverc :: --project ${dir_4_test} --path_2_test_dir "$RealBin/${dir_4_test}/jobs/Jobs" > ${dir_4_test}.html}; system ($cmd); Commented Apr 7, 2015 at 7:41
4

This doesn't sound like a problem with PATH - I would expect it to give the message 'perl' is not recognized as an internal or external command, operable program or batch file.

I have not seen this error message, but http://nirlevy.blogspot.com/2008/03/system-cannot-execute-specified-program.html makes some suggestion for related programs. Or maybe ask on an Active State forum.

1
  • 1
    Agreed. This has nothing to do with the path - the error is different for that. You probably need the Microsoft Visual C++ 2005 Redistributable Package (x86): microsoft.com/downloads/en/…
    – troyt
    Commented Dec 28, 2010 at 18:52
2

I had the same error. I was able to solve it by changing the order of the Perl64 entries in the PATH variable in the Environment Variables. I moved the C:\Perl64\bin to be before C:\Perl64\site\bin and it worked.

0
2

I had a similar error which was solved by adding the .pl extension to the script name, which I had forgotten to do.

I could not get it to work otherwise even with my Perl's location (C:\Apps\Perl\bin) verified as in %PATH%.

0

The problem lies in the installation directory.

The Perl PATH variable will be set to C:\Program Files\perl (depends on 32 or 64 bit of course), BUT, the default installation directory is C:\perl. This is kind of sneaky actually as you would assume the installer would be more intelligent about this, but it sets the environment variable to that directory no matter WHERE you install the damned thing.

Not the answer you're looking for? Browse other questions tagged or ask your own question.