在窗口注册表注册文件扩展名?

qul*_*zam 8 c# windows registry

我想在窗口注册表中注册我自己的项目扩展.我搜索谷歌,至少我发现这个代码,这很好用,但我不明白一行."%L"是什么意思.

C#代码是

string ext = ".ext";
        RegistryKey key = Registry.ClassesRoot.CreateSubKey(ext);
        MessageBox.Show(exePath);
        key.SetValue("", "My Project");
        key.Close();

        key = Registry.ClassesRoot.CreateSubKey(ext + "\\Shell\\Open\\command");
        //key = key.CreateSubKey("command");

        key.SetValue("", "\"" + Application.ExecutablePath + "\" \"%L\"");
        key.Close();

        key = Registry.ClassesRoot.CreateSubKey(ext + "\\DefaultIcon");
        key.SetValue("", Application.StartupPath + "\\icon.ico");
        key.Close();
Run Code Online (Sandbox Code Playgroud)

这是困扰我的线,

 key.SetValue("", "\"" + Application.ExecutablePath + "\" \"%L\"");
Run Code Online (Sandbox Code Playgroud)

请解释一下,我非常感谢你提前.

ros*_*oft 5

如果您的应用程序可执行文件在 C:\your dir\your program.exe 中,则该行将转换为:

"C:\你的目录\你的程序.exe" "%L"

%L 被转换为您正在打开的文件,因此您的程序正在执行将该文件作为第一个参数