0

I have 100 files, for example c1.mat, c2.mat, ..., c100.mat

I want to loop through each file to run a simulation within a software, taking one file at a time.

How do I write a batch script for the same?

@echo off 
title conductivity changes

start fem.srn -e c1.mat

This script opens the program. But does not take the file c1.mat as a variable.

Mofi
  • 46,139
  • 17
  • 80
  • 143

2 Answers2

0

For a bash script (sorry misread the original question when I saw 'batch')

for file in *
do
   echo $file
done

Replace the echo command above with your command. you can also replace * with something like c*.mat or *.mat Also you can use a word other than file.

Ken Clement
  • 748
  • 4
  • 13
0

This for loop might work.

for /l %%a in (1,1,100) do (
    start fem.srn -e c%%a.mat
    timeout 5
    rem timeout needed?
)
cwahls
  • 743
  • 7
  • 22