@echo off
if exist c:\Groups.txt del c:\Groups.txt
for /F "tokens=*" %%* in ('net localgroup ^| find "*"') do call :Sub %%*
goto :eof
:sub
set name=%*
echo Name=%name%
net localgroup "%name:~1%" | find /i /v "comment" | find /i /v "members" | find /i /v "completed successfully" >> c:\Groups.txt