windows shell\command\open 值的语法 - %1 vs %l vs %L

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/249577/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 11:32:42  来源:igfitidea点击:

Syntax of shell\command\open values - %1 vs %l vs %L

windowsshellexecute

提问by Joseph

one of the programs I'm developing at work is reading the registry to figure out how to open files that it is given from another application (we didn't use ShellExecute because we need to process id, and I failed to look at ShellExecuteEx closely enough to see that it gives the process handle, and it's too late now, anyway). It already works, so this is more for my own edification, but does anyone know why some of the entries use %l or %L instead of %1? At least for "%l" it could be a typo, but "%L" seems unlikely. In fact, Media Player uses "%L" in the open commands for various audio files. I'm fairly sure it means the same thing as %1, if only because I can't think of anything else it could be.

我在工作中开发的程序之一是读取注册表以找出如何打开从另一个应用程序提供的文件(我们没有使用 ShellExecute,因为我们需要处理 id,我没有仔细查看 ShellExecuteEx足以看到它提供了进程句柄,无论如何现在为时已晚)。它已经有效了,所以这更多是为了我自己的启发,但是有谁知道为什么有些条目使用 %l 或 %L 而不是 %1?至少对于“%l”,它可能是一个错字,但“%L”似乎不太可能。事实上,媒体播放器在各种音频文件的打开命令中使用“%L”。我相当确定它与 %1 的意思相同,只是因为我想不出它可能是什么。

My current favorite theory is that it's a joke about how l and 1 are easy to confuse. Or it could stand for "location", but that would be lame :)

我目前最喜欢的理论是,这是一个关于 l 和 1 很容易混淆的笑话。或者它可以代表“位置”,但这会很蹩脚:)

回答by PhiLho

On some old systems (Win95, WinNT4), using %1 may give the short path, using %L always gives the Long path...

在一些旧系统(Win95、WinNT4)上,使用 %1 可能给出短路径,使用 %L 总是给出长路径...