Perl从命令行执行的问题
上周我在 WinXP 上用 Strawberry Perl 替换了 ActivePerl。
我发现我必须使用 perl myperl.pl 命令运行 Perl 脚本;否则我只需要在安装 Strawberry 之前运行 myperl.pl
。我怎样才能像以前一样只运行myperl.pl
?
我检查了我的环境配置如下。
<前><代码>C:\>小路 C:\Program Files\ActiveState Komodo 编辑 5\;C:\Perl\site\bin;C:\Perl\bin;C:\Perl\bin\;C:\Program Files\CodeSynthesis XSD 3.2\bin\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem; C:\Program Files\ATI Technologies\ATI 控制面板;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Common Files\Thunder Network\KanKan \Codecs;C:\strawberry\c\bin;C:\strawberry\perl\bin`
安装成功后,Strawberry Perl 路径已在 Path 值中列出。
我错过了什么吗?谢谢您的建议。
I replaced ActivePerl with Strawberry Perl on my WinXP last week.
I found I must run my Perl script with the command of perl myperl.pl
; otherwise I only need run myperl.pl
before install Strawberry. How can I only run myperl.pl
as before?
I checked my environment configuration as below.
C:\> Path C:\Program Files\ActiveState Komodo Edit 5\;C:\Perl\site\bin;C:\Perl\bin;C:\Perl\bin\;C:\Program Files\CodeSynthesis XSD 3.2\bin\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem; C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Common Files\Thunder Network\KanKan \Codecs;C:\strawberry\c\bin;C:\strawberry\perl\bin`
Strawberry Perl path already listed in the Path value after install successfully.
Anything I missed? Thank you for your suggestion.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
为了完整起见,这里还有另外 2 种方法,它们不会使 .pl 脚本可执行,但您可以使用它们将 Perl 脚本变为可执行文件。
For completeness here's 2 other methods that don't make a .pl script executable, but you could use them to make your perl script into an executable.
从命令提示符尝试:
--
公里x
Try from command prompt:
--
kmx
您需要将
.pl
文件扩展名与 Strawberry Perl 的可执行文件关联起来(它是 Windows 的东西,而不是 Perl 的东西)。为此,有几种方法(您可以在 google 上搜索或在 ServerFault 上询问最佳方法或完整列表),但我通常在 XP 上使用的方法是:
以防万一我搞砸了,这里是来自 Microsoft 的官方说明:
http://support.microsoft.com/kb/307859
更新
请参阅 kmx 的答案 - 他的方法是全命令行的,因此对我来说似乎比 GUI 错误更可取......我确认它也有效(至少没有参数)
You need to associate
.pl
file extension with Strawberry Perl's executable (it's a Windows thing, not a Perl thing).To do so, there are a couple of ways (you can google or ask on ServerFault for the best one or full list), but the one I usually use on XP is:
In case I messed up, here's the official instructions from Microsoft:
http://support.microsoft.com/kb/307859
UPDATE
Please see kmx's answer - his method is all-command-line and as such seems much more preferable to me that GUI blundering... I confirmed that it works too (without parameters, at least)
您可能需要将
.PL
扩展名放入PATHEXT
环境变量中。这将使.pl
文件与PATH
变量一起使用。输入
以查看您是否已设置。如果不是,请转到“我的电脑”->“属性”->“高级”,然后按选项卡底部的“环境变量”按钮。您可以在其中将
.PL
添加到PATHEXT
变量中。或者您可以将其设置在运行以启动 cmd 的某个批处理文件中:
You might need to put the
.PL
extension into thePATHEXT
environment variable. This will make.pl
files work with thePATH
variable.Type
to see if you're set up. If you're not, then go to My Computer->properties->Advanced and press the "Environment Variables" button on the bottom of the tab. There you can add
.PL
to thePATHEXT
variable.OR you could just set it in some batch file that you run to initiate cmd: