下面三个任意一个都可:
winexec('cmd /c bcp "SELECT * FROM MyDataBase.dbo.表1" queryout E:/A.xls -c -T',sw_hide);
ShellExecute(0,nil,'cmd',PChar('/c bcp "SELECT * FROM MyDataBase.dbo.表1" queryout E:/A.xls -c -T'),Nil,SW_HIDE);
ShellExecute(0,nil,'Command.com',PChar('/c bcp "SELECT * FROM MyDataBase.dbo.表1" queryout E:/A.xls -c -T'),Nil,SW_HIDE);
若输出文本 输出文件改扩展名即可 E:/B.TXT