Solved how to excute a command for multiple files ( Batch process)

January 21, 2012 at 07:30:04
Specs: Windows Vista
Hi , I use a command called Evalglare to calculate glare in pictures in .pic files . the command line is very simple and it goes like this.
evalglare filename.pic
I have a set of 200 pictures in one folder , is it possible to calculate glare for all of them in one command line. I don't have good knowledge in DOS , so I would appreciate it if someone wrote a command line for me.thanks

See More: how to excute a command for multiple files ( Batch process)

Report •

#1
January 21, 2012 at 07:49:42
Someone may be able to come up with a better way to do it (i hope) but a very basic crude method to create a batch file (command file) would be to open a command prompt and go to the folder where the pictures are located.
Once at the folder level enter the command dir /b > mylist.bat
then type notepad mylist.bat to open the file in notepad. this will give you a file that contains a list of all your pic files.

Once in notepad you'll have to manually add call evalglare in front of each line. You can speed up this process by putting the words call evalglare in your clipborad and paste in at the beginning of each line. Once call evalglare is added to each line, save the file and run it by typing mylist and hitting enter.

That will run the program using each of the file names.

Maybe someone has a more efficient method that would not require pasting 200 times. Like I said, this method is crude but I believe it will work.


The grass may not be greener on the other side but might have less weeds...
Web Based Remote Support Software


Report •

#2
January 21, 2012 at 08:36:12
✔ Best Answer
At prompt set the current folder to the one holding the .pic files by typing

CD /D Your_Folder

then type the following command

for %j in (*.pic) do evalglare "%j" >> glare.txt

Open with Notepad glare.txt to view the result.

By the way there is no DOS under Vista and what you believe the DOS prompt is the NT system console driven by cmd.exe instead of command.com.


Report •

#3
January 21, 2012 at 14:04:49
Puppet and Ivo , thanks for the help. I tried Ivo's method and it worked like a charm. I can't thank you enough. I'm doing work for my Master's thesis and that is going to save me a lot of time instead of typing the command and the file name 200 times .

Report •

Related Solutions

#4
January 24, 2012 at 21:45:57
ok , I have another command that I would like to use to calculate glare for 200 pictures but it has two steps and it goes like this

findglare -p filename.pic > newfilename.glr ( this step to tell the software to create a .glr file)
then the second step is

glarendx -t dgi newfilename.glr

anyway I can do this in batch process with one command line. or may be two commands , first on to create .glr files , then second command to calculate glare.


Report •

#5
January 25, 2012 at 09:42:00
for %a in (*.pic) do (findglare -p %a.pic >> newfilename.glr&glarendx -t dgi newfilename.glr)

see if that works


Report •

#6
January 25, 2012 at 10:27:09
Skorpio07 I trid your command worked I got an error message saying can't open filename.pic.pic so I dleted the second .pic

for %a in (*.pic) do (findglare -p %a >> newfilename.glr&glarendx -t dgi newfilename.glr)

and it worked . thanks a lot . you saved me time and effort.


Report •

#7
January 25, 2012 at 11:13:32
skorpoio07
an UPDATE
the result I got are so mixxed up , and I think it is because I'm telling the software to produce .glr with the same name of different .pic files , is there anyway to fix the command line so Radiance ( the software) creates a new different .glr file for each .pic file

here is the result , I should get few description lines then only one line at the end that contains numbers ( in bold), but instead i got many lines with numbers for each file


C:\Users\owner\Desktop\hdri>for %a in (*.pic) do (findglare -p %a >> ne.glr&glar
endx -t dgi ne.glr)

C:\Users\owner\Desktop\hdri>(findglare -p blue.pic 1>>ne.glr & glarendx -t dgi
ne.glr )
1 2 -p
#?RADIANCE
findglare -p blue.pic
VIEW= -vth -vp 5.391 5.214 1.836 -vd -0.999956 -0.00935085 0 -vu 0 0 1 -vh 180 -
vv 180 -vo 0 -va 0 -vs 0 -vl 0
FORMAT=ascii
glarendx -t dgi

0.000000 11.290786

C:\Users\owner\Desktop\hdri>(findglare -p cc5_c1.pic 1>>ne.glr & glarendx -t d
gi ne.glr )
1 2 -p
#?RADIANCE
findglare -p blue.pic
VIEW= -vth -vp 5.391 5.214 1.836 -vd -0.999956 -0.00935085 0 -vu 0 0 1 -vh 180 -
vv 180 -vo 0 -va 0 -vs 0 -vl 0
FORMAT=ascii
glarendx -t dgi

0.000000 14.280201
0.000000 14.289699

C:\Users\owner\Desktop\hdri>(findglare -p fish_c1.pic 1>>ne.glr & glarendx -t
dgi ne.glr )
1 2 -p
#?RADIANCE
findglare -p blue.pic
VIEW= -vth -vp 5.391 5.214 1.836 -vd -0.999956 -0.00935085 0 -vu 0 0 1 -vh 180 -
vv 180 -vo 0 -va 0 -vs 0 -vl 0
FORMAT=ascii
glarendx -t dgi

0.000000 15.877580
0.000000 16.094118
0.000000 16.103611

C:\Users\owner\Desktop\hdri>(findglare -p fish_c1_fc.pic 1>>ne.glr & glarendx
-t dgi ne.glr )
1 2 -p
findglare: cannot get view from picture "fish_c1_fc.pic"
#?RADIANCE
findglare -p blue.pic
VIEW= -vth -vp 5.391 5.214 1.836 -vd -0.999956 -0.00935085 0 -vu 0 0 1 -vh 180 -
vv 180 -vo 0 -va 0 -vs 0 -vl 0
FORMAT=ascii
glarendx -t dgi

0.000000 15.877580
0.000000 16.094118
0.000000 16.103611

C:\Users\owner\Desktop\hdri>(findglare -p l1_c1.pic 1>>ne.glr & glarendx -t dg
i ne.glr )
1 2 -p
#?RADIANCE
findglare -p blue.pic
VIEW= -vth -vp 5.391 5.214 1.836 -vd -0.999956 -0.00935085 0 -vu 0 0 1 -vh 180 -
vv 180 -vo 0 -va 0 -vs 0 -vl 0
FORMAT=ascii
glarendx -t dgi

0.000000 19.024146
0.000000 22.088634
0.000000 22.272711
0.000000 22.280757

C:\Users\owner\Desktop\hdri>(findglare -p lcp_c1.pic 1>>ne.glr & glarendx -t d
gi ne.glr )
1 2 -p
#?RADIANCE
findglare -p blue.pic
VIEW= -vth -vp 5.391 5.214 1.836 -vd -0.999956 -0.00935085 0 -vu 0 0 1 -vh 180 -
vv 180 -vo 0 -va 0 -vs 0 -vl 0
FORMAT=ascii
glarendx -t dgi

0.000000 21.449353
0.000000 19.461073
0.000000 22.563425
0.000000 22.750783
0.000000 22.758976

C:\Users\owner\Desktop\hdri>(findglare -p l_c1.pic 1>>ne.glr & glarendx -t dgi
ne.glr )
1 2 -p
#?RADIANCE
findglare -p blue.pic
VIEW= -vth -vp 5.391 5.214 1.836 -vd -0.999956 -0.00935085 0 -vu 0 0 1 -vh 180 -
vv 180 -vo 0 -va 0 -vs 0 -vl 0
FORMAT=ascii
glarendx -t dgi

0.000000 18.172918
0.000000 23.133138
0.000000 21.354344
0.000000 24.110397
0.000000 24.273575
0.000000 24.280704

C:\Users\owner\Desktop\hdri>(findglare -p l_c1_fc.pic 1>>ne.glr & glarendx -t
dgi ne.glr )
1 2 -p
findglare: cannot get view from picture "l_c1_fc.pic"
#?RADIANCE
findglare -p blue.pic
VIEW= -vth -vp 5.391 5.214 1.836 -vd -0.999956 -0.00935085 0 -vu 0 0 1 -vh 180 -
vv 180 -vo 0 -va 0 -vs 0 -vl 0
FORMAT=ascii
glarendx -t dgi

0.000000 18.172918
0.000000 23.133138
0.000000 21.354344
0.000000 24.110397
0.000000 24.273575
0.000000 24.280704

C:\Users\owner\Desktop\hdri>(findglare -p reg_c1.pic 1>>ne.glr & glarendx -t d
gi ne.glr )
1 2 -p
#?RADIANCE
findglare -p blue.pic
VIEW= -vth -vp 5.391 5.214 1.836 -vd -0.999956 -0.00935085 0 -vu 0 0 1 -vh 180 -
vv 180 -vo 0 -va 0 -vs 0 -vl 0
FORMAT=ascii
glarendx -t dgi

0.000000 25.173648
0.000000 18.350760
0.000000 23.354977
0.000000 21.553562
0.000000 24.350416
0.000000 24.517168
0.000000 24.524457

C:\Users\owner\Desktop\hdri>(findglare -p springl_c1.pic 1>>ne.glr & glarendx
-t dgi ne.glr )
1 2 -p
findglare: warning -- missing 59% of samples
#?RADIANCE
findglare -p blue.pic
VIEW= -vth -vp 5.391 5.214 1.836 -vd -0.999956 -0.00935085 0 -vu 0 0 1 -vh 180 -
vv 180 -vo 0 -va 0 -vs 0 -vl 0
FORMAT=ascii
glarendx -t dgi

0.000000 22.850048
0.000000 25.173648
0.000000 18.350760
0.000000 23.354977
0.000000 21.553562
0.000000 24.350416
0.000000 24.517168
0.000000 24.524457

C:\Users\owner\Desktop\hdri>(findglare -p springl_c2.pic 1>>ne.glr & glarendx
-t dgi ne.glr )
1 2 -p
findglare: warning -- missing 59% of samples
#?RADIANCE
findglare -p blue.pic
VIEW= -vth -vp 5.391 5.214 1.836 -vd -0.999956 -0.00935085 0 -vu 0 0 1 -vh 180 -
vv 180 -vo 0 -va 0 -vs 0 -vl 0
FORMAT=ascii
glarendx -t dgi

0.000000 23.342150
0.000000 23.290787
0.000000 25.654457
0.000000 18.745566
0.000000 23.803563
0.000000 21.976825
0.000000 24.816025
0.000000 24.985797
0.000000 24.993218

C:\Users\owner\Desktop\hdri>(findglare -p springr_c1.pic 1>>ne.glr & glarendx
-t dgi ne.glr )
1 2 -p
findglare: warning -- missing 59% of samples
#?RADIANCE
findglare -p blue.pic
VIEW= -vth -vp 5.391 5.214 1.836 -vd -0.999956 -0.00935085 0 -vu 0 0 1 -vh 180 -
vv 180 -vo 0 -va 0 -vs 0 -vl 0
FORMAT=ascii
glarendx -t dgi

0.000000 26.050146
0.000000 23.684945
0.000000 23.632497
0.000000 26.066377
0.000000 19.031380
0.000000 24.156813
0.000000 22.295282
0.000000 25.197490
0.000000 25.372839
0.000000 25.380511

C:\Users\owner\Desktop\hdri>(findglare -p springr_c2.pic 1>>ne.glr & glarendx
-t dgi ne.glr )
1 2 -p
findglare: warning -- missing 59% of samples
#?RADIANCE
findglare -p blue.pic
VIEW= -vth -vp 5.391 5.214 1.836 -vd -0.999956 -0.00935085 0 -vu 0 0 1 -vh 180 -
vv 180 -vo 0 -va 0 -vs 0 -vl 0
FORMAT=ascii
glarendx -t dgi

0.000000 23.482192
0.000000 26.466344
0.000000 24.080507
0.000000 24.027603
0.000000 26.482701
0.000000 19.396362
0.000000 24.556546
0.000000 22.679481
0.000000 25.606548
0.000000 25.783433
0.000000 25.791171

C:\Users\owner\Desktop\hdri>(findglare -p test.pic 1>>ne.glr & glarendx -t dgi
ne.glr )
1 2 -p
#?RADIANCE
findglare -p blue.pic
VIEW= -vth -vp 5.391 5.214 1.836 -vd -0.999956 -0.00935085 0 -vu 0 0 1 -vh 180 -
vv 180 -vo 0 -va 0 -vs 0 -vl 0
FORMAT=ascii
glarendx -t dgi

0.000000 25.934962
0.000000 23.618786
0.000000 26.623002
0.000000 24.220263
0.000000 24.167063
0.000000 26.639501
0.000000 19.519379
0.000000 24.699099
0.000000 22.812400
0.000000 25.756254
0.000000 25.934485
0.000000 25.942283

C:\Users\owner\Desktop\hdri>(findglare -p test_fc.pic 1>>ne.glr & glarendx -t
dgi ne.glr )
1 2 -p
findglare: cannot get view from picture "test_fc.pic"
#?RADIANCE
findglare -p blue.pic
VIEW= -vth -vp 5.391 5.214 1.836 -vd -0.999956 -0.00935085 0 -vu 0 0 1 -vh 180 -
vv 180 -vo 0 -va 0 -vs 0 -vl 0
FORMAT=ascii
glarendx -t dgi

0.000000 25.934962
0.000000 23.618786
0.000000 26.623002
0.000000 24.220263
0.000000 24.167063
0.000000 26.639501
0.000000 19.519379
0.000000 24.699099
0.000000 22.812400
0.000000 25.756254
0.000000 25.934485
0.000000 25.942283


Report •

Ask Question