简体   繁体   English

perl将所有命令行参数都塞入$ ARGV [0]

[英]perl crams all command-line arguments into $ARGV[0]

In Win 7, This is the program: 在Win 7中,这是程序:

# TestArg.pl
print "\nin TestArg.pl, \$ARGV[0]=$ARGV[0], \$ARGV[1]=$ARGV[1], \$ARGV[2]=$ARGV[2]"; 

When I run: TestArg.pl 1 2 3 at the command line 当我运行时:在命令行中的TestArg.pl 1 2 3

I get: in TestArg.pl, $ARGV[0]= 1 2 3, $ARGV[1]=, $ARGV[2]= 我得到:在TestArg.pl中, $ARGV[0]= 1 2 3, $ARGV[1]=, $ARGV[2]=

Instead of having them distributed. 而不是分发它们。

In the Registry: 在注册表中:

HKEY_USERS\...\Software\Classes\pl_auto_file\shell\open\command is:
Default  REG_SZ "C:\Perl\bin\perl.exe" "%1" "%*"

I tried to change REG_SZ to REG_MULTI_SZ , but it wouldn't let me, though I'm the administrator. 我试图将REG_SZ更改为REG_MULTI_SZ ,但是尽管我是管理员,但它不允许我这样做。

Would that have fixed the problem if I could have edited it? 如果可以编辑该问题,是否可以解决该问题?

If so, how do I get access? 如果是这样,我如何获得访问权限?

If it wouldn't have helped, what would? 如果没有帮助,那会是什么?

应该是%* ,而不是"%*"

The answer I left in the comments above is too far down the thread to show, so I'll repeat it here, where it can be seen. 我在上面的评论中留下的答案距离主题太远了,无法显示,因此我将在这里重复它,在那里可以看到它。

As Kenosis suggested, the question was answered 4 years ago at question 1695188. 正如Kenosis所建议的,这个问题在4年前的问题1695188中得到了回答。

It requires a %* at the end of the Applications\\perl.exe\\shell\\open\\command registry field. 在Applications \\ perl.exe \\ shell \\ open \\ command注册表字段的末尾需要一个%*。

I HAD that %*, but only in the pl_auto_file\\shell\\open\\command field. 我有该%*,但仅在pl_auto_file \\ shell \\ open \\ command字段中。

It's interesting that whoever is setting that field has been doing it wrong for at least 4 years! 有趣的是,设置该字段的任何人至少在4年内都做错了!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM