Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
447 views
in Technique[技术] by (71.8m points)

registry - How to pass in multiple file/folder paths via a right-click event (verb) to an executable?

Related:

How to add new items to right-click event on Folders and Files in Windows?

I added custom right-click verb to all files by adding registry keys to HKEY_CLASSES_ROOT*. End result looks like this

HKEY_CLASSES_ROOT*ShellTestRightClickCommand

-------Default = c:RightClickTest.exe "%1"

Problem: when selecting multiple files c:RightClickTest.exe will be called several times(number of selected files)

What I need: pass-in multiple files paths to one executable

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you're looking for a quick and dirty workaround, you can create a shortcut to your executable in '%AppData%MicrosoftWindowsSendTo' Now you can select a bunch of files, right click, select Send To, and your application.

This will pass all the selected files as individual command line options to one instance of your application... keep in mind there is a 32767 character command line limit which will limit the number of files you can pass to your application using this method, and make sure your program wont' try to open files it doesn't know how to deal with. In the long run, Factor Mystic's method is way better.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...