Command line? Don't know what you mean, but here's how you can write to a file on a web server. Location has to have write permissions enabled. Also, you might have to filter out various end of line/carriage return characters out of your data. E.g., vbcrlf, <br>, ...
dim filename, source, address, sql, rsTable1, fileobj, thefile, line
filename = "whatever.csv"
source = "/some_address/" & filename
address = Server.MapPath(source)
sql = "SELECT field1, field2, ... "
sql = sql + "FROM table1 ... "
set rsTable1 = Server.CreateObject("ADODB.Recordset")
rsTable1.ActiveConnection = "yourconnectstring"
rsTable1.source = sql
rsTable1.Open()
set fileobj = Server.CreateObject("Scripting.FileSystemObject")
'Check for existing file if you want to
'if fileobj.FileExists(address) then
'
'else
'
'end if
set thefile = fileobj.CreateTextFile(address, true)
'first line is field names
thefile.WriteLine ("field1name" & vbTab & "field1name" ...)
while not rsTable1.EOF
line = replace(rsdetail("field1"), vbtab, "") & vbtab & replace(rsdetail("field2"), vbtab, "") & ...
thefile.WriteLine line
rsTable1.MoveNext()
wend
thefile.Close
set thefile = nothing
set fileobj = nothing
rsTable1.Close
set rsTable1 = nothing
[/code]