Perl not running in Windows 10

2019-05-23 17:00发布

问题:

I've just downloaded ActivePerl for Windows 10 on my 64 bit laptop, but when I go to the command prompt, perl -v fails unless the directory is C:\Perl64\bin in which case it tells me that I have Perl 5.20.2 Copyright Larry Ullman etc, but if I try and open perl files anywhere, nothing happens, if I run perl.exe it just shows me a command window with a flashing bar and nothing happens, and when I try and run .pl programs in Eclipse it tells me predictably that because perl-v failed it won't run.

What can I do to get .pl files running?

回答1:

You must create a file association between the .pl file extension and the Perl runtime.

At a command prompt type the following.

assoc .pl=PerlScript
ftype PerlScript=c:\perl\bin\perl.exe %1 %*

Choose perl.exe or wperl.exe, depending on your need to get a visible command window.



回答2:

To get perl to be recognized, you must add C:\Perl64\bin to the PATH environment variable. Go to Control Panel > System > Advanced System Settings > Environment Variables. Edit the line containing PATH in the top box marked User variables for , and add ;C:\Perl64\bin (note the semicolon) to the end. Be sure not to corrupt anything that's already there.

installing perl in windows 7