Click here to Skip to main content
15,891,828 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I created a right click shortcut entry (in Explorer's right click context menu) for my application, and I want to get the folder or file path on which right click is done?


my registry entry is

HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\copy path2\command
where command = "C:\Users\Atrix\Desktop\ConsoleApplication1.exe";


my c# code....

C#
string fileName = "myfile.ext";
string fullPath;
fullPath = Path.GetFullPath(fileName);

//and I m trying to save the path to txt file.

string log = fullPath;   
string filePath = @"C:\Users\Atrix\Desktop\log.txt";
            FileStream myLog = new FileStream(filePath,FileMode.Append ,FileAccess.Write);
            StreamWriter sw = new StreamWriter(myLog);
            sw.Write(log);
            sw.Close();
            myLog.Close();




when I right click on any file on desktop and select "copy path" option
then every time same data is saved in txt file

C:\Users\Atrix\Desktop\myfile.ext


I want the complete path of the selected file with the extension of file....

plz help me....
Posted
Comments
BacchusBeale 29-Mar-15 23:08pm    
why not use OpenFileDialog?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900