无法将ar#从c#console app传递给.bat文件

时间:2016-02-12 09:15:04

标签: c# batch-file

line break

.bat文件是

ProcessStartInfo psi = new ProcessStartInfo(@"C:\Visual\ConsoleApp\FirstConsole\FirstConsole\RunSqlBat.bat");//Path of the .bat file

string sqlPath = @"C:\Sln\DevDatabase\Algorithm.sql";//Path of sql file I run using bat file
psi.Arguments =args[0]+ " " + args[1] + " " + args[2] + " " + args[3] + " " + sqlPath;//Passing arguments
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
psi.UseShellExecute = false;

System.Diagnostics.Process p = System.Diagnostics.Process.Start(psi);
p.Start();
p.Kill();
System.Console.Read();

值不会传递给bat文件。(在cmd中运行bat文件时工作正常)

当我打开cmd提示时,给出了FirstConsole.exe serverName DatabaseName userName Password

sqlcmd -S %1 -d %2 -U %3 -P %4 -i %5
pause

如何将参数传递给.bat文件

注意:我已经使用过

Error as
sqlcmd:'-s':Missing argument

0 个答案:

没有答案
相关问题