Hi guys,

Just wondering if anyone has run into this problem before... My scenario is that I want to add an option to the explorer context menu that appears whenever a user right clicks on a folder or drive. So I add the following reg key:

HKEY_CLASSES_ROOT\Folder\shell\MyProgram\command
"(Default)" value within is set to:
C:\MyProgram.exe "%1"

and all works fine for folders, the %1 gets expanded to the relevant folder path that the user clicked on. However, when right clicking on a drive (e.g C drive in My Computer) the fact that the path then has a trailing backslash seems to seems to mess things up as the backslash acts as an escape character and makes the last quote mark get passed in as part of the command line (and the backslash is removed completely).

For example if the following command is called from a context menu generated by the user right clicking on their C drive:
"MyProgram.exe" "%1"
You would expect the final command line to be this:
MyProgram.exe C:\
But what actually happens is this:
MyProgram.exe C:"

Anyone got a solution? I can add a backslash in manually (e.g "%1\") but then it works fine for drives and not for folders. Anyone know of a solution that will work for both?

Thanks
Chris