C# : capturing the file and path of a file when right I right click on the file

I am developing a windows application with c#. I need to get the file and folder name when I right click on a file to use for other functions. Right now I have made the registry keys to get my application running. When I right click on a file (word, ppt, txt, etc) my context menu shows the option I added, Set Perm. When that is selected my windows application opens up. In a text box on the form, I want to display the full file name and path. Is there a way to do that? I've added %0 and %1 in the registry to the end of the argument to launch my app, but it does not work. I've tried h:\temp\myapp.exe %1 and h:\temp\myapp.exe %0. Putting the %1 or %0 in quotes did not change anything. I am in Windows 8 using Visual Studio 2017. Thanks.
dodgerfanAsked:
Who is Participating?
 
MishaProgrammerCommented:
Can you process selected file event?
In this case you can use method
Path.GetFullPath(path)

Open in new window

to get ful path.
Also you can use method
Path.GetFileNameWithoutExtension(path)

Open in new window

to get file name.
0
 
dodgerfanAuthor Commented:
I was calling code to pull that name from the wrong event. Once I got it to the right event, it fires correctly and shows the file name and ful path. Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.