Simplest loop to perform actions on x dragged files?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Simplest loop to perform actions on x dragged files?

#31 Post by penpen » 01 Apr 2014 11:50

Squashman wrote:I have people who use my Drag and Drop batch files by putting them into their SendTo Context Menu. Is this different then making a direct Context menu? Putting the batch file in the Sendto looks to have the same problem with the Ampersand.

If you use the first method in that context menue, you have no file group call (like with "SendTo"), but multiple single file calls to "C:\Test.bat" (example below).
So there should be no problem in computing the parameter file name (just use the doublequoted call format):
"My Item.reg":

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\My Item\Command]
@="C:\\Test.bat \"%1\""

"C:\Test.bat"

Code: Select all

@echo off
set "fileName=%~1"
setlocal enableDelayedExpansion
echo(!fileName!
pause
endlocal
goto :eof

penpen

Post Reply