ReneGe
asked on
Batch File: "Drag and Drop" multiple files to batch file
Hi there,
How can I make this batch file work?
I want to drag and drop multiple files to the batch file, then display them.
The display order is not important.
Thanks,
Rene
How can I make this batch file work?
I want to drag and drop multiple files to the batch file, then display them.
The display order is not important.
Thanks,
Rene
@ECHO OFF
REM CREATING ARRAY
FOR /L %%A IN (1,1,100) DO (
IF "%%A" EQU "" GOTO Display
SET [File.%%A]=%~%%A
)
:Display
REM DISPLAYING ARRAY
FOR /F "tokens=2 delims==" %%A IN ('SET [File.') DO ECHO %%A
PAUSE
EXIT
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
For me it would take 84 filenames mainly 8.3 but 85 and it says "go away". Should sufficent I asssume?
Steve
Steve
For the sake of completeness: %* works just as well, it's even a bit shorter; just a matter of personal preference:
@echo off
setlocal enabledelayedexpansion
set /a ArgCount = 0
for %%a in (%*) do (
set /a ArgCount += 1
set [File.!ArgCount!]=%%~a
)
for /l %%i in (1, 1, %ArgCount%) do (
echo ![File.%%i]!
)
ASKER
More than ennuf! I will be processing not more then 40 files at a time.
Assuming the limmit is due to the string size of the arguments, I made some few tests. I found that the path\file size does affect the quantity of files being pulled out; something between 8043 and 8172.
Cheers,
Rene
Assuming the limmit is due to the string size of the arguments, I made some few tests. I found that the path\file size does affect the quantity of files being pulled out; something between 8043 and 8172.
Cheers,
Rene
ASKER
@oBdA: Cool!
Thanks, glad that got solved, I just didn't have time to do the full write up before...
~bp
~bp
ASKER
Don't worry Bill. Thanks for your contribution :)
ASKER
Thanks oBdA!
I will also award points to Steve for advise and Bill as part of his answer was used and may be an inspiration to oBdA's answer. Thanks guys!
Cheers,
Rene