@echo off
setlocal
set InputFile=groups.txt
for /f "delims=" %%a in ('type "%InputFile%"') do (
set Group=%%~a
call :process
)
echo Done.
goto :eof
:process
echo Processing %Group% ...
set GroupFile=%Group%.txt
if exist "%GroupFile%" del "%GroupFile%"
for /f "tokens=2 delims=,=" %%a in ('dsquery group -name "%Group%" ^| dsget group -members') do (
>>"%GroupFile%" echo %%a
)
goto :eof
|