我正在尝试使用此代码在右键单击时获取所选文件的文件路径,但我收到错误“找不到文件”我很困惑放置 %1 请帮助我,谢谢!
RegistryKey rKey = Registry.ClassesRoot.OpenSubKey(@"Directory\shell", true);
String[] names = rKey.GetSubKeyNames();
foreach (String s in names)
{
System.Windows.Forms.MessageBox.Show(s);
}
RegistryKey newKey = rKey.CreateSubKey("open");
RegistryKey newSubKey = newKey.CreateSubKey("command");
newSubKey.SetValue("%1",@"C:\Users\system\Documents\Visual Studio 2010\Projects\dg\dg\bin\Debug\dg.exe");
newSubKey.Close();
newKey.Close();
rKey.Close();
static void Main(string[] args)
{
if (args.Length > 0)
{
folderpath = args[0];