Having trouble running multiple files through a batch file from the button bar.
Moderators: Hacker, petermad, Stefan2, white
Having trouble running multiple files through a batch file from the button bar.
I have a compiled matlab script that uses matlab runtime and runs from the command line. I run it in this batch file that supplies the file name for the EEG file to analyze. "MiniQReport.exe %1 EC 27"
This batch file runs from a button in the button bar with the batch file as the command and %S as the parameter.
I select one file or many files and click the and it only processes the first file and then cmd window closes and the process stops. It takes about 90 seconds to process each file. Then the window closes.
I don't know if running only one file and then stopping is related to the way the matlab runtime works.
Any ideas on how I could run all the files with one click? I'm only going to do this job once and I could click and run each file separately. I have about 70 files to run so I can do it one-at-a-time in less than 2 hours but running them all at once would be a lot more fun. I would also have less chance for error.
This batch file runs from a button in the button bar with the batch file as the command and %S as the parameter.
I select one file or many files and click the and it only processes the first file and then cmd window closes and the process stops. It takes about 90 seconds to process each file. Then the window closes.
I don't know if running only one file and then stopping is related to the way the matlab runtime works.
Any ideas on how I could run all the files with one click? I'm only going to do this job once and I could click and run each file separately. I have about 70 files to run so I can do it one-at-a-time in less than 2 hours but running them all at once would be a lot more fun. I would also have less chance for error.
Re: Having trouble running multiple files through a batch file from the button bar.
Why dont you try it from command line with two filenames to see if both files are processed.I don't know if running only one file and then stopping is related to the way the matlab runtime works.
Also is "MiniQReport.exe %1 EC 27" the total content of the batch file?
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Having trouble running multiple files through a batch file from the button bar.
While %S send all filenames %1 only gets the first one.
Re: Having trouble running multiple files through a batch file from the button bar.
As Petermad and Gral wrote: try it from the command prompt first to see what works for you. Maybe you should run it like this:
But the problem here would be if filename contains spaces.
Maybe there is a help or something for this MiniQReport.exe?
Saso
Code: Select all
MiniQReport.exe "filename1 filename2" EC 27
Maybe there is a help or something for this MiniQReport.exe?
Saso
#224551
Re: Having trouble running multiple files through a batch file from the button bar.
2lawson415
☑ Run minimized
Command: ComSpec% /q/c for %f in
Parameters: ("%S") do start "" MiniQReport.exe %%f EC 27
☑ Run minimized
Command: ComSpec% /q/c for %f in
Parameters: ("%S") do start "" MiniQReport.exe %%f EC 27
Overquoting is evil! 👎
Re: Having trouble running multiple files through a batch file from the button bar.
I was thinking some similar buttons:
or
These should work with unicode names (not on Windows XP)
Code: Select all
TOTALCMD#BAR#DATA
%COMSPEC% /C
if exist %S1\ ((echo DO NOT MARK DIRECTORIES!) & (echo.) & pause) else chcp 65001 && %%COMSPEC%% /C for /F "usebackq delims=" %%n in (`type %WF`) do start "" MiniQReport.exe "%%n" EC 27
%COMMANDER_EXE%,2
Open all selected files with MiniQReport.exe at the same time
-1
Code: Select all
TOTALCMD#BAR#DATA
%COMSPEC% /C
if exist %S1\ ((echo DO NOT MARK DIRECTORIES!) & (echo.) & pause) else chcp 65001 && %%COMSPEC%% /C for /F "usebackq delims=" %%n in (`type %WF`) do call MiniQReport.exe "%%n" EC 27
%COMMANDER_EXE%,2
Open all selected files with MiniQReport.exe one after another
-1
It might be necessary with a path to MiniQReport.exeTo make the buttons:
1. Mark the text in the box here above (click SELECT ALL).
2. Copy it to the ClipBoard (press Ctrl+C).
3. Right click on TC's buttonbar and choose "Paste".
These should work with unicode names (not on Windows XP)
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Having trouble running multiple files through a batch file from the button bar.
Note to this command:
I would suggest you add
after the START command so each file is processed one at a time.
Saso
Code: Select all
do start "" MiniQReport.exe "%%n"
Code: Select all
/wait
Saso
#224551
Re: Having trouble running multiple files through a batch file from the button bar.
You can also use TCBL if you do not have to process Unicode Filename.
e option is to have the resulting batch file opened with notepad before starting it.
Code: Select all
pgm:<path to>\tcbl.exe
params:-qe %L MiniQReport.exe "$f" EC 27
Re: Having trouble running multiple files through a batch file from the button bar.
There would be no point in "start" then. And asynchronous launch was proposed based on this:
Overquoting is evil! 👎
Re: Having trouble running multiple files through a batch file from the button bar.
Thank you MadPeter
I used the second button suggestion and it worked perfectly. I have about 80 files to run and they each take 50-70 seconds. I suspect this 2 core i5 machine would choke on doing them all at once so I chose the sequential option.
I used the second button suggestion and it worked perfectly. I have about 80 files to run and they each take 50-70 seconds. I suspect this 2 core i5 machine would choke on doing them all at once so I chose the sequential option.
petermad wrote: 2022-11-28, 23:10 UTC I was thinking some similar buttons:orCode: Select all
TOTALCMD#BAR#DATA %COMSPEC% /C if exist %S1\ ((echo DO NOT MARK DIRECTORIES!) & (echo.) & pause) else chcp 65001 && %%COMSPEC%% /C for /F "usebackq delims=" %%n in (`type %WF`) do start "" MiniQReport.exe "%%n" EC 27 %COMMANDER_EXE%,2 Open all selected files with MiniQReport.exe at the same time -1
Code: Select all
TOTALCMD#BAR#DATA %COMSPEC% /C if exist %S1\ ((echo DO NOT MARK DIRECTORIES!) & (echo.) & pause) else chcp 65001 && %%COMSPEC%% /C for /F "usebackq delims=" %%n in (`type %WF`) do call MiniQReport.exe "%%n" EC 27 %COMMANDER_EXE%,2 Open all selected files with MiniQReport.exe one after another -1
It might be necessary with a path to MiniQReport.exeTo make the buttons:
1. Mark the text in the box here above (click SELECT ALL).
2. Copy it to the ClipBoard (press Ctrl+C).
3. Right click on TC's buttonbar and choose "Paste".
These should work with unicode names (not on Windows XP)
Re: Having trouble running multiple files through a batch file from the button bar.
Thank you everyone,
I'm grateful to each of you for your suggestions. I chose MadPeter's second suggestion because it looked easiest and because there was an option for sequential processing. As a single EEG analysis takes about a minute on this 2 core i5 and I have 70- to 80 files, I was afraid it would choke on that many files.
I will try the simultaneous solution on another computer and report back.
Gratefully,
Robert Lawson
I'm grateful to each of you for your suggestions. I chose MadPeter's second suggestion because it looked easiest and because there was an option for sequential processing. As a single EEG analysis takes about a minute on this 2 core i5 and I have 70- to 80 files, I was afraid it would choke on that many files.
I will try the simultaneous solution on another computer and report back.
Gratefully,
Robert Lawson
Re: Having trouble running multiple files through a batch file from the button bar.
Oops, Petermad,
I apologize for getting your name wrong. Mad Peter is funnier but not appropriate.
I tried using the first script that you posted above that analyzes the files simultaneously. I selected 74 files and clicked on the icon and a many terminals opened up very quickly. The script processed about 12 files and then a bunch of folders with long numerical names. That these folders appeared after the last of the 12 files was processed. It also made many failed reports of 0kb size.
I apologize for getting your name wrong. Mad Peter is funnier but not appropriate.
I tried using the first script that you posted above that analyzes the files simultaneously. I selected 74 files and clicked on the icon and a many terminals opened up very quickly. The script processed about 12 files and then a bunch of folders with long numerical names. That these folders appeared after the last of the 12 files was processed. It also made many failed reports of 0kb size.
Re: Having trouble running multiple files through a batch file from the button bar.
2lawson415
I originally made the two buttons for notepad.exe, and I have never tried with more than about 10 files opening at the same time.
I guess that 74 instances of the same program can choke most computers.
I originally made the two buttons for notepad.exe, and I have never tried with more than about 10 files opening at the same time.
I guess that 74 instances of the same program can choke most computers.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Having trouble running multiple files through a batch file from the button bar.
Thank you for the recent help.
We used that batch file with a lot of archival data for testing.
Now we want to do a validity test and use real data and ages.
We will need to add another argument to this batch file to run from a button and then enter 2 arguments from a file.
Old batch file: "MiniQReport.exe %1 EC 27"
This file says run MiniQReport.exe to analyze this EEG file name and compare the data to normative data for eyes closed condition using the norms for a 27 year old.
Here is the new batch file:
"MiniQReport.exe %1 EC %2"
The first argument is file name and the second is age.
We would like to enter these arguments from a text file. I think we used to do something like this with list2multi.
The file might be like this:
filename 4
filename 16
filename 63
How might we do this keeping our long file names?
We used that batch file with a lot of archival data for testing.
Now we want to do a validity test and use real data and ages.
We will need to add another argument to this batch file to run from a button and then enter 2 arguments from a file.
Old batch file: "MiniQReport.exe %1 EC 27"
This file says run MiniQReport.exe to analyze this EEG file name and compare the data to normative data for eyes closed condition using the norms for a 27 year old.
Here is the new batch file:
"MiniQReport.exe %1 EC %2"
The first argument is file name and the second is age.
We would like to enter these arguments from a text file. I think we used to do something like this with list2multi.
The file might be like this:
filename 4
filename 16
filename 63
How might we do this keeping our long file names?