我尝试使用C#程序的参数调用esriRegAsm.exe。 目的是注册一个DLL。因此,我通常使用Dll作为参数和一些其他参数(/ p:Desktop/s)来调用esriRegAsm.exe。如果我将它输入cmd.exe,这工作正常。不知何故,我认为这个过程只发送第一个字符串到cmd而不是整个参数列表,但我需要“”作为路径中的空格字符。 为了调试,我添加了一个消息框,字符串看起来没问题。通过C#进程使用cmd.exe的多个参数
反斜杠或双反斜杠似乎不重要。
string targetDir = this.Context.Parameters["targ"];
string programFilesFolder = this.Context.Parameters["proFiles"];
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/C \"" + programFilesFolder + "Common Files\\\\ArcGIS\\\\bin\\\\esriRegAsm.exe\" " + "\"" + targetDir + "RArcGISTest.dll\" /p:Desktop /s";
MessageBox.Show("/C \"" + programFilesFolder + "Common Files\\\\ArcGIS\\\\bin\\\\esriRegAsm.exe\" " + "\"" + targetDir + "RArcGISTest.dll\" /p:Desktop /s");
process.StartInfo = startInfo;
process.Start();
正如我不能武官的消息框的照片...输出为:
/C“C:\ Program Files文件(x86)的\ Common Files文件\ ArcGIS的\ BIN \ esriRegAsm.exe “‘C:\安装\ RArcGISTest.dll’/ p:桌面/ S”
问题是...? – 2012-03-21 22:45:27
...如何让它工作 – steffan 2012-03-21 23:08:46