Using the greater than sign DOS will write the output of your command to a text file.

To output a basic command to a text file

c:\> dir > filename.txt

OUTPUT the users in a group to a text file from command line on a domain controller.

c:\> net group groupname > filename.txt