You need to set the command to pass the related path. Instead of using:
// From the related article
regcmd.SetValue("",this.txtPath.Text);
You should be able to use:
string command = string.Format("\"{0}\" \"%1\"", this.txtPath.Text);
regcmd.SetValue("", command);
This builds a command string that includes the path to your executable (this.txtPath.Text
) followed by the selected item used when triggering the context menu (%1
).