Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Receiving arguments from Windows Context menu

I have done this before but for the life of me can't remember how to do this...

In my explorer context menu I added a new entry (go to regedit...go to HKEY_CLASSES_ROOT...bla bla bla)... Now when I click on my option I want to pass in the file path, file name, those kind of things to my application...and then use it there?

like image 625
Jean Avatar asked Oct 14 '22 11:10

Jean


1 Answers

The default value of the .ext\shell\open\command key should contain the path to your .exe with the "%1" argument. Explorer substitutes that with the full path to the file. Which you can read in your .exe through the Main() method argument or Environment.GetCommandLineArgs().

like image 105
Hans Passant Avatar answered Oct 18 '22 12:10

Hans Passant