如何将路径作为参数传递给自定义上下文菜单选项?

How to pass path as parameter to a custom made context menu option?

我创建了自定义上下文菜单选项。此选项将从调用它的位置删除文件。自定义上下文菜单已成功添加,它还调用了我的删除应用程序。但问题是我不知道如何将路径传递到文件的 remove.exe 从它被调用的地方。

这是我的自定义上下文菜单代码

RegistryKey _key = Registry.ClassesRoot.OpenSubKey("*\Shell", true);
RegistryKey newkey = _key.CreateSubKey("Remove");
newkey.SetValue("AppliesTo", "under:T:");

RegistryKey subNewkey = newkey.CreateSubKey("Command");
subNewkey.SetValue("", "C:\remove.exe");
subNewkey.Close();

newkey.Close();
_key.Close();

更改此行:

subNewkey.SetValue("", "C:\remove.exe");

对此:

subNewkey.SetValue("", "C:\remove.exe %1");

OS 将单击的文件的文件名发送为 %1。