two variables in for /f loops RRS feed

  • Question

  • hi friends

    i have learned how to create many domain users using a simple text file (each user is located in one line)

    for /f %v in (c:\users-List.txt) do dsadd user cn=u%v,dc=mydomain,dc=lab   (that's great)

    but now i have a problem

    i must add unique password in front of each user in that text file (or i can create another text file which contains list of passwords in turn).

    now how can provide that for each user, the related password (in front of the user name in the same line or in 2nd text file) be set?

    my file text is similar to this:

    mary  P@ssw0rd

    john  mycompany123

    albert  hellodady

    do i need two variables in for /f loop? is it possible?

    also i know the following approach (piping two for /f loops) is not the solution:

    for /f %v in (c:\users-list.txt) do dsadd user cn=........ | for /f %v in (c:\password-list) do dsmod user -pwd %v

    any help please

    thanks in advanced 

    • Edited by john.s2011 Wednesday, October 1, 2014 9:10 AM
    Wednesday, October 1, 2014 9:09 AM


All replies