Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

two variables in for /f loops

$
0
0

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 



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>