Saved Bookmarks
| 1. |
Solve : How to create a batch file contains a repeating lines (loop)?? |
|
Answer» HI all, I want to make a batch file (or just a txt file) that contains repeating commands (using a defined number of loop), with some different char on each line. E.g. Package name 51B1 number 1 Package name 51B2 number 2 Package name 51B3 number 3 ... Package name 51B99 number 99 I wish I can explain it more technically, but I have a very limited knowledge in DOS commands. So I hope you understand what I'm saying.. Thank you in advance regards, NugrahaTry the following Code: [Select]FOR /L %%G IN (1,1,5) DO echo Package Name 51B%%G number %%G This will loop from 1 to 5 in increments of 1 I have TRIED, but it doesn't work. Maybe I need to explain more. Let's say I make the above commands in a file, say loop.bat What I need is, if I double CLICK loop.bat, it will make ANOTHER bat file (or just a txt file), say NAMED as result.txt that contains text: Package name 51B1 number 1 Package name 51B2 number 2 Package name 51B3 number 3 ... Package name 51B99 number 99 I hope it's clearer now. Again, thank you in advance regards, NugrahaSave the following code in loop.bat Code: [Select]FOR /L %%G IN (1,1,99) DO echo Package Name 51B%%G number %%G >> result.txt This will now output to a text file result.txt |
|