I can quite easily dump data into a text file such as:
sqlcmd -S myServer -d myDB -E -Q \"select col1, col2, col3 from SomeTable\"
-o \"MyData.txt\"
>
A note for anyone looking to do this but also have the column headers, this is the solution that I used an a batch file:
sqlcmd -S servername -U username -P password -d database -Q "set nocount on; set ansi_warnings off; sql query here;" -o output.tmp -s "," -W
type output.tmp | findstr /V \-\,\- > output.csv
del output.tmp
This outputs the initial results (including the ----,---- separators between the headers and data) into a temp file, then removes that line by filtering it out through findstr. Note that it's not perfect since it's filtering out -,-
—it won't work if there's only one column in the output, and it will also filter out legitimate lines that contain that string.