Solved how to write batch code for permutations to text file

September 4, 2014 at 10:19:19
Specs: Windows 7, i3
I want a batch file that will create the permutations of 6 numbers and then out the result to a text file. each number ranges are different and should be inputted via dialog box like:

Input number 1: ...
Input number 1 range: .... to ....

Input number 2: ...
Input number 2 range: .... to ....

i know in excel vba its something like For n1 = 1 To 20 or For n2 = 3 To 15

I dont know how its done in batch coding/scripting to get the permutations and ranges. Kindly help....

message edited by Knowledge_is_key


See More: how to write batch code for permutations to text file

Report •


#1
September 5, 2014 at 00:56:40
I did this a couple years ago and I'll dig it out for you. Be advised that it doesn't take a very big set for the processing load to get way out of hand.

IIRR 7 tokk 8 hours.

If this is a scripting exercise, great. If it's for a practical req you might consider VB or c++.

=====================
M2 Golden-Triangle

message edited by Mechanix2Go


Report •

#2
September 5, 2014 at 05:52:12
✔ Best Answer
::====== script starts here ===============
::
:: comb.bat 2014-09-05 19:25:10.72
@echo off > NEWFILE & setLocal enableDELAYedeXpansioN

set M=7

for /L %%a in (1 1 !M!) do (
for /L %%b in (1 1 !M!) do (
for /L %%c in (1 1 !M!) do (
for /L %%d in (1 1 !M!) do (
for /L %%e in (1 1 !M!) do (
for /L %%f in (1 1 !M!) do (
for /L %%g in (1 1 !M!) do (
echo.%%a %%b %%c %%d %%e %%f %%g
))))))) >> NEWFILE
goto :eof
::====== script ends here =================

=====================
M2 Golden-Triangle


Report •

#3
September 5, 2014 at 10:37:38
Mechanix, it works perfectly thank you

message edited by Knowledge_is_key


Report •

Related Solutions


Ask Question