我怎样才能在Vista中64通过命令行参数通过文件关联? [英] How can I pass command-line arguments via file association in Vista 64?

查看:202
本文介绍了我怎样才能在Vista中64通过命令行参数通过文件关联?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何才能在Vista中64通过文件关联一遍命令行参数?

How can one pass command line arguments via file association in Vista 64?

我最近建成运行Vista旗舰版64位的PC。我注意到几个Perl脚本我转移到没有被通过命令行参数失败所致。作为一个简单的测试,我写了下面(foo.pl):

I recently built a PC running Vista Ultimate 64-bit. I noticed several of the Perl scripts I transferred failed due to command-line arguments not being passed. As a simple test, I wrote the following (foo.pl):

#!/usr/bin/perl -w
use strict;
my $num_args = $#ARGV + 1;
print "${num_args} arguments read\n";
print "$^X\n" # to see what was being used

运行foo.pl 1 2 3不期望得到:

Running "foo.pl 1 2 3" undesirably yielded:

0 arguments read
C:\strawberry\perl\bin\perl.exe

运行的perl foo.pl 1 2 3果然产生了:

Running "perl foo.pl 1 2 3" expectedly yielded:

3 arguments read
C:\strawberry\perl\bin\perl.exe

在我的旧的Windows XP的PC,无论调用返回3个参数。我记录更多的我的侦探在这里( win32.perl.org维基谈话),但我还没有找到一个解决方案,工程。

On my old Windows XP PC, both invocations returned 3 arguments. I documented more of my sleuthing here (win32.perl.org wiki talk), but I've yet to find a solution that works.

我也试过的ActivePerl-5.10.0.1004-MSWin32-x64-287188.msi无济于事。

I've also tried ActivePerl-5.10.0.1004-MSWin32-x64-287188.msi to no avail.

任何帮助将是AP preciated。这是推动我疯狂。

Any help would be appreciated. This is driving me batty.

推荐答案

我只是想在我的Vista旗舰版64的ActivePerl-5.10.0.1004-MSWin32-x64-287188.msi和它的工作。

I just tried ActivePerl-5.10.0.1004-MSWin32-x64-287188.msi on my Vista 64 Ultimate and it worked.

F:\prog\perl>foo.pl 1 2 3
3 arguments read
C:\Perl64\bin\perl.exe

这意味着<一个href="http://stackoverflow.com/questions/444388/how-can-one-pass-command-line-arguments-via-file-association-in-vista-64#444452">devio是正确的:它必须是一个文件关联的问题;

That means devio is right: it must be an "file association" issue;

在一个探险家,你的特等右键单击文件,并要求打开方式:用Perl的命令行间preTER,它会工作(并选择始终使用该程序打开这种类型的文件)。

On an explorer, right-click on your .pl file and ask "Open with": use the "Perl Command Line interpreter" and it will work (and select "always use this program to open this type of file").

在我看来,Vista的文件扩展管理器中删除将参数传递给函数的能力似乎错了......

To me, "Vista's file extension manager removed the ability to pass arguments to functions" seems wrong...


我确实看到:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Perl\shell\Open\command]
@="\"C:\\Perl64\\bin\\perl.exe\" \"%1\" %*"

如果您的安装没有把那种价值在您的注册表意义,这是因为:

Meaning if your installation did not put that kind of value in your registry, it is because:

  • 您没有的ActivePerl-5.10.0.1004-MSWin32-x64-287188.msi
  • 的安装过程中选择的关联
  • 或您的帐户没有足够的权限来写在注册表中任何东西。
  • you did not select the association during the setup of ActivePerl-5.10.0.1004-MSWin32-x64-287188.msi
  • or your account has not enough privilege to write anything in the registry.


请注意:

  • 似乎在Vista上的常规扩展管理器没有通过参数(这意味着 \C:\\ Perl64 \\ \\斌perl.exe所在\\%1 \而不%* 参数)
  • 在注册表中添加是必要的作为记录了SO
  • it seems the regular extension manager on Vista does not pass argument (meaning \"C:\\Perl64\\bin\\perl.exe\" \"%1\" without the %* argument)
  • the registry addition is necessary as documented by the SO

这篇关于我怎样才能在Vista中64通过命令行参数通过文件关联?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆