只要在注册表HKEY_CLASSES_ROOT\Folder\shell添加子项,指定要运行的程序就可以了
因为程序运行时,你所点击的文件夹的路径会当做一个参数传进去。

解决方案 »

  1.   

    举个例子:在所有文件的右键菜单中添加“用记事本打开”。
    在HKEY_CLASSES_ROOT\Folder\shell下新建“用记事本打开(&N)”子键;在新键下面再建立“command”子键,将“command”键的默认键值改为“C:\Windows\NOTEPAD.EXE %1”。
      

  2.   

    console下入口函数定义:
        main( int argc, char *argv[ ], char *envp[ ] )
       里面有char *argv[ ],可以找到你要的文件夹win32 application下入口函数定义:
       int WINAPI WinMain(
         HINSTANCE hInstance,  // handle to current instance
         HINSTANCE hPrevInstance,  // handle to previous instance
         LPSTR lpCmdLine,      // pointer to command line
         int nCmdShow          // show state of window
       );
       里面有lpCmdLine,可以找到你要的文件夹MFC中使用:
       LPTSTR GetCommandLine(VOID)