Hi All,
I would like to ask some tips how to do this, trying to drag and drop mulitple files on a bat file that run a program.
My bat file is like this, so far it only will open two text files i drap and drop. What if i want to open ten or more text files? tried to google but just really can't get it work.
Thank you.
C:\Windows\notepad.exe %1
C:\Windows\notepad.exe %2
pause
Regards,
mt
drag and drop multiple file on a bat file
Moderator: DosItHelp
Re: drag and drop multiple file on a bat file
Something about like that:
Note that the batch code receives the whole path for each file. At some point (depending on the length of the path) you will exceed the maximum length of a command line if you drop too many files.
Steffen
Code: Select all
@echo off &setlocal
for %%i in (%*) do start "" notepad %%i
Steffen
Re: drag and drop multiple file on a bat file
Hi Steffen,
Thank you able to make it work.
was trying to make a program (not notepad) to run multiple files by batch.
But i realize it will open and run the program same times together.
My silly way
C:\Windows\notepad.exe %1
C:\Windows\notepad.exe %2
will make the program run first file (%1) then second file (%2).
for %%i in (%*) do start "" notepad %%i
I can open two drag and drop files same time but if there is a way to make the program run drag and drop files one by one? ( as the program i intend to run is a render program that eat memories).
Thank you for your time.
Regards,
mt
Thank you able to make it work.
was trying to make a program (not notepad) to run multiple files by batch.
But i realize it will open and run the program same times together.
My silly way
C:\Windows\notepad.exe %1
C:\Windows\notepad.exe %2
will make the program run first file (%1) then second file (%2).
for %%i in (%*) do start "" notepad %%i
I can open two drag and drop files same time but if there is a way to make the program run drag and drop files one by one? ( as the program i intend to run is a render program that eat memories).
Thank you for your time.
Regards,
mt
Re: drag and drop multiple file on a bat file
found the behaviour i would like it to be after i remove the "start"
c:
cd xxxxxx(directory where the program)
for %%i in (%*) do xxxxx(program exe file name) %%i
Thank you very much.
Regards,
mt
c:
cd xxxxxx(directory where the program)
for %%i in (%*) do xxxxx(program exe file name) %%i
Thank you very much.
Regards,
mt
Re: drag and drop multiple file on a bat file
My bad, sorry. I added the START command because people usually ask for asynchronous processing of several files
Steffen
Steffen