To write command line results to a text file, add the following to the end of your command before running it:
> "C:\<your path here>\<your file name here>.txt"
Command prompt will output to the file instead of to the window so you can search it later. As an example, you can use this to run commands through a remote management tool and then download the resulting text file for analysis without impacting the end user.