Apr 16, 2005 #1 D davyzhu Advanced Member level 1 Joined May 23, 2004 Messages 494 Helped 5 Reputation 10 Reaction score 2 Trophy points 1,298 Location oriental Activity points 4,436 how to write loop in batch Hello all, I want to write a loop in Batch, the idea was written in C. //------------------------ for(par0=0.1;par0<1;par0=par0+0.1) { command1 par0 par1; command2 par0 par2; command3 par0 par3; } //------------------------ //the par is parameter for command How to change it to Batch(I use NT), thanks! Regards, Davy
how to write loop in batch Hello all, I want to write a loop in Batch, the idea was written in C. //------------------------ for(par0=0.1;par0<1;par0=par0+0.1) { command1 par0 par1; command2 par0 par2; command3 par0 par3; } //------------------------ //the par is parameter for command How to change it to Batch(I use NT), thanks! Regards, Davy
Apr 16, 2005 #2 E echo47 Advanced Member level 6 Joined Apr 7, 2002 Messages 3,933 Helped 638 Reputation 1,274 Reaction score 90 Trophy points 1,328 Location USA Activity points 33,176 NT's batch mode has no floating point support, but this is better than nothing: Code: @echo off for /L %%X in (1,1,9) do (echo command1 0.%%X par1) & (echo command2 0.%%X par2) & (echo command3 0.%%X par3) You can remove the "echo" strings later. From the command prompt, try typing "help for" I'm using Win2k. Maybe NT is similar.
NT's batch mode has no floating point support, but this is better than nothing: Code: @echo off for /L %%X in (1,1,9) do (echo command1 0.%%X par1) & (echo command2 0.%%X par2) & (echo command3 0.%%X par3) You can remove the "echo" strings later. From the command prompt, try typing "help for" I'm using Win2k. Maybe NT is similar.
Apr 16, 2005 #3 J jimjim2k Advanced Member level 3 Joined May 17, 2001 Messages 996 Helped 23 Reputation 46 Reaction score 13 Trophy points 1,298 Activity points 7,178 Hi And for unix/linux sh... Code: for i in `command generats a sort of listing` do //now $i is refer to i-th item in the generated list. do what you want done example: Code: for i in `ls *.pdf` do pdf2txt $i $i.txt done tnx
Hi And for unix/linux sh... Code: for i in `command generats a sort of listing` do //now $i is refer to i-th item in the generated list. do what you want done example: Code: for i in `ls *.pdf` do pdf2txt $i $i.txt done tnx