0

I have a folder with 100+ .XLSM files. They are each set to auto-run a sequence, save and close when opened. I currently have a batch file set to open each file in the folder. However, I've only been able to set a "delay" before opening the next file. Some of the files take 10 seconds to run the sequence and close, and some take about 50 seconds, so I have to set the "delay" at 50 second pause for all files. I am looking for a way to set the files to open One-At-A-Time, and open the next file as soon as the previous file has closed, instead of having to wait the full 50 seconds for each.

Here is the current batch file I am using...

@echo off 

for %%x in (C:\...\*.xlsm) do (

  start %%x

  timeout /t 50 /nobreak >nul

)

I've seen suggestions to use the /wait cmd, but it wasn't clear and I couldn't get it to work. I know very little on how to use batch files. Thanks for any help or suggestions.

npocmaka
  • 55,367
  • 18
  • 148
  • 187
Bret
  • 1
  • 1
  • 2

1 Answers1

0

Try ;

@echo off
for %%x in (C:\...\*.xlsm) do (
  echo Starting.. %%x
  start "" /wait %%x
)

I tested with my *.mp4 files i belive it will work with *.xlsm files also.

John DOE
  • 400
  • 1
  • 3
  • 18