How to Pass MULTIPLE filenames to a Context Menu Shell Command?
Solution 1
You may want to look at this post, as it says that this isn't really possible to pass multiple files to a single instance and you must rely on some form of IPC(Inter process Communication).
Solution 2
You can use Send To for this. It supports multiple files.
In case this website goes offline:
Open shell:sendto
with Windows + R
or paste it into your explorer address bar. It should redirect you to:
C:\Users\<yourusername>\AppData\Roaming\Microsoft\Windows\SendTo
Create a shortcut to your program in this folder and you should see it in your explorer right-click menu under Send to
WinWin
Updated on June 17, 2022Comments
-
WinWin almost 2 years
Passing a single filename to a context menu shell command is simple:
[HKEY_CLASSES_ROOT\*\shell\MyProgram\Command] @="program.exe %1"
But if I select multiple files,
program.exe
is invoked for each such selected file.What I would like to do instead is invoke
program.exe
only once, passing to it all the filenames currently selected.How to do this?
-
akinuri about 5 yearsIt seems there's a limit to how many files can be sent depending on the files' path. I can send 504 files with paths
C:\test\001.txt
. 504 file names amount to 7560 chars (no space), 8063 chars (space delimited). Sending 505 files (7575 chars [no space]; 8079 [space delimited]) doesn't work. -
Shakeer Mirza about 5 yearsSaved me so much time. I use it for compare software.. Thanks
-
preachers almost 5 yearsWhen trying to pass the file
G:\New [folder] (4)\Untitled-2.txt
to a Powershell script, the result becomesG:\New [folder] 4 \Untitled-2.txt
. It seems that parentheses cannot be parsed correctly. Any solution? -
gargoylebident about 2 years@preachers try escaping parenths with a back tick:
G:\New [folder] `(4`)\Untitled-2.txt