Convert output to a string in batch script

biltipto

Honorable
Mar 5, 2012
2
0
10,510
Hello,
I am trying to run a dsget group cmd to view members of an AD group, then try and do a look up of that user and compare the logged in user to the output of the list. Need some help writing that script.
I know this is not exactly a windows 7 question, but not sure what category this would belong too.

Here is what i have so far:

set dgngrp="CN=DragonUsersGG,OU=Misc,OU=Groups,OU=LOWELLGENERAL,DC=lowellgeneral,DC=org"
set usrname1=%USERNAME%


dsget group %dgngrp% -members > members.txt

dsquery user -samid %username1% > userdn.txt

Im thinking i will use a command like this, but not sure what commands to enter in.

FOR /F "tokens=*" %%A IN ('COMMAND ^| FIND "Any string from the output"') DO SET Variable=%%A