刚学DELPHI不久,最近想写个小工具,工具需要运行一个带参数的DOS命令且需要该命令后面加个管道将结果保存到一个TXT文件,问题是,用winexec执行后,并没生成这个TXT文件。
1. 该命令原型: osql.exe -E -d local -Q "select balance from mem_localmemberbaseinfo where uniqueID ='123'"
参数说明: -E 本地执行
-d 设定操作的数据库是local
-Q 操作指令 2.使用管道:cmd-输入-osql.exe -E -d local -Q "select balance from mem_localmemberbaseinfo where uniqueID ='123'" > C:\result.txt 这句能正确被执行 3.DELPHI下:
WinExec(pchar('command.exe /c osql -E -d local -Q "select * from mem_localmemberbaseinfo where uniqueID = ' + QuotedStr(123)+'">C:\result.txt'),SW_HIDE);
这句运行后并没生成result.txt,烦请各位达人指点
1. 该命令原型: osql.exe -E -d local -Q "select balance from mem_localmemberbaseinfo where uniqueID ='123'"
参数说明: -E 本地执行
-d 设定操作的数据库是local
-Q 操作指令 2.使用管道:cmd-输入-osql.exe -E -d local -Q "select balance from mem_localmemberbaseinfo where uniqueID ='123'" > C:\result.txt 这句能正确被执行 3.DELPHI下:
WinExec(pchar('command.exe /c osql -E -d local -Q "select * from mem_localmemberbaseinfo where uniqueID = ' + QuotedStr(123)+'">C:\result.txt'),SW_HIDE);
这句运行后并没生成result.txt,烦请各位达人指点
不过要use shellapi
这个是直接用api,很不错哦