我嘗試使用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