Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

confused variables

Status
Not open for further replies.

tjbradford

Technical User
Dec 14, 2007
229
GB
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



 
Contrary to what seems to be belief, this forum is not for batch file scripts.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top