Start New Discussion within our Software Development Community

I am tring to call the same subroutine several times. The first time it runs it works correctly. Everytime after the first time it doesn't run the subroutine in order. I was wondering if anyone knows how to do this. Here is my current script.

@echo off

set description=Disabled %date:~4,2%-%date:~7,2%-%date:~10,4%

set return=next1
set value="Domain Controllers,DC=dtint,DC=com"
GoTO :Program
:next1
set return=next2
set value="Computers,DC=dtint,DC=com"
GOTO :Program
:next2
set return=next3
set value="Computers,OU=DTI-AU,OU=DTI-Offices,OU=DTI-Admin,DC=dtint,DC=com"
GOTO :Program
:next3
GOTO :END

:Program

dsquery computer ou=%value% -inactive 10 -limit 0 > C:\ComputersDisableSept17-2012.txt

@echo Number of Inactive Computers:

dsquery computer ou=%value% -inactive 10 -limit 0 | find "CN=" /c

@echo Disabling Computers

dsquery computer ou=%value% -inactive 10 -limit 0 | dsmod computer -disabled Yes -desc "%description%"

@echo Moving Computers

for /F "Tokens=*" %%i in (C:\ComputersDisableSept17-2012.txt) do dsmove %%i -newparent OU=ToBePurged,OU=DTI-Admin,DC=dtint,DC=com

GOTO %return%

:END

Thanks

This question has already been answered. Start a new discussion instead.