INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

confused variables

confused variables

(OP)
The problem i'm having is i can't seem to pass the -pwd entry correctly.

I have tried % and %% and %! to make the field appear as a variable but with not joy, however if i place %SOME% in it with the var i made above it works, I think it's todo with the qty of % in this field and the next one e.g. %%n but I have no idea on how to wrap it so it's read correctly as a variable.

anyone able to assist me in this cockup ?

heres the code \/

@echo on

setlocal enableDelayedExpansion
SET SOME=123456
SET SOME[1]=Timing
SET SOME[2]=Table
SET SOME[3]=Carrot
SET SOME[4]=Flight
SET SOME[5]=Honey
SET SOME[6]=Bunny
SET SOME[7]=Magic
SET SOME[8]=Beans
SET SOME[9]=Field
SET SOME[10]=Clock
SET SOME[11]=Highway
FOR /L %%i IN (1,1,2) DO (
set /a rand=!random!%%5+1
set /a countit=!random!*100/32768+1
set dsrunner=dsmod CN=Supply%%i,OU=%%i,OU=Staff,OU=CSE,DC=WCS,DC=INTERNAL
for %%N in (!rand!) do dsmod user "CN=Supply%%i,OU=Supply,OU=Staff,OU=CSE,DC=WCS,DC=INTERNAL" -pwd %SOME[%n]%
echo
)

/\
end



RE: confused variables

Contrary to what seems to be belief, this forum is not for batch file scripts.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close