我正在尝试使用Process类从C#代码执行批处理文件。批处理获取参数,作为带引号的字符串传递给ProcessStartInfo.Arguments。一切都工作得很好,除了这样一个事实,当批处理执行时,它预先设置了几个垃圾ascii符号,我无法弄清楚它们来自哪里。 批处理脚本看起来很简单:
%1 -S .\sqlexpress -i %2
批处理只是在特定位置执行sqlcmd.exe并传入要执行的SQL脚本。当我在命令行中手动尝试它时,它工作得很好,所以这不是生成的命令本身。想法?
这是构建脚本执行结果的样子: ![
[gallio] D:\Development\project_A\Trunk\build\compile>"D:\Development\project_A\Trunk\build\tools\sqlcmd\SQLCMD.EXE" -S .\sqlexpress -i "C:\Temp\project_A_consolidated_sql_scripts.sql"
[gallio] '' is not recognized as an internal or external command,
[gallio] operable program or batch file.
[gallio] Creating project_A database
[gallio] Changed database context to 'master'.
[gallio] Creating project_ADBUser login
[gallio] Changed database context to 'project_A'.
[gallio] Creating project_ADBUser user
[gallio] Creating project_A Schema
[gallio] Changed database context to 'project_A'.
] Image
谢谢。