[英]Is it possible to run Visual Studio SQL Server project from utility/batch file?
[英]run a batch with parameters from visual studio
我正在尝试使用参数运行批处理文件,它应该是动态的,但它不会按照我想要的方式运行。
我有一些特定目录的代码,我希望它更具动态性。 我正在从visual studio的textBox中检索一个目录。
String rep_source = textBox12.Text;
String attribute = textBox4.Text;
String rep_destination = textBox5.Text;
String poly_dest = textBox13.Text;
string SPECIFIC_DIRECTORY= textBox7.Text; //I want to use this for my code
string command = @"/c powershell -executionpolicy unrestricted C:\Folder1\Folder2\batchfile.Bat" + " " + rep_source + " " + poly_dest + " " + attribute + " " + rep_destination;
System.Diagnostics.Process.Start("cmd.exe", command);
事物代码工作,但当我尝试检索目录。
string command = @"/c powershell -executionpolicy unrestricted " +SPECIFIC_DIRECTORY +"\\batchfile.Bat" + " " + rep_source + " " + poly_dest + " " + attribute + " " + rep_destination;
这不会编译并给我我想要的东西。 我甚至无法访问批处理文件本身。
尝试这个:
String com = @"/c powershell -executionpolicy unrestricted C:\Folder1\Folder2\batchfile.Bat" + " " + rep_source + " " + poly_dest + " " + attribute + " " + rep_destination;
ProcessInfo = new ProcessStartInfo("cmd.exe", "/c " + com );
ProcessInfo.CreateNoWindow = true;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.