C# C逐字逐句似乎不适用于.startinfo.arguments?
我有一个应用程序,我可以选择多个MSI的相同MSI,不同版本的目录,我将能够安装或卸载从这个应用程序 我拉入MSI的列表,完整路径,带C# C逐字逐句似乎不适用于.startinfo.arguments?,c#,wpf,windows-installer,verbatim,C#,Wpf,Windows Installer,Verbatim,我有一个应用程序,我可以选择多个MSI的相同MSI,不同版本的目录,我将能够安装或卸载从这个应用程序 我拉入MSI的列表,完整路径,带 string MSILocation = @"C:\test\"; string[] MSIFiles = Directory.GetFiles(MSILocation, "*.MSI", SearchOption.TopDirectoryOnly); 从这里我填充了一个listview,一旦选择了一个,我就点击install按钮。 但是,当我检查我的安装代码
string MSILocation = @"C:\test\";
string[] MSIFiles = Directory.GetFiles(MSILocation, "*.MSI", SearchOption.TopDirectoryOnly);
从这里我填充了一个listview,一旦选择了一个,我就点击install按钮。
但是,当我检查我的安装代码时,逐字逐句似乎都搞糟了
string MSIname = lboMSIList.SelectedItem.ToString();
Process p = new Process();
p.StartInfo.FileName = "MSIEXEC.EXE";
p.StartInfo.Arguments = @"/i " + MSIname;
p.Start();
即使listview以single/显示文件,最终结果也总是以double显示/
在那里的某个地方,它丢失了文本字符串
如果我更改代码并运行.FileName=@msiexec.exe/ic:\test\test1.msi,它工作正常,但我需要能够从文件名列表中进行选择
有什么想法吗
string MSILocation = @"C:\test\";
string[] MSIFiles = Directory.GetFiles(MSILocation, "*.*", SearchOption.TopDirectoryOnly).Select(f => Path.GetFileName(f)).ToArray();
使用以上文件名数组填充listview
使用方法如下
string MSILocation = @"C:\test\";
string MSIname = lboMSIList.SelectedItem.ToString();
Process p = new Process();
p.StartInfo.FileName = "MSIEXEC.EXE";
p.StartInfo.Arguments = string.Format(
"{0} {1}", @"/i",Path.Combine(MSILocation , MSIname );
p.Start();
它在调试器视图中是否与“\”一起输出?这只是debugger.Path.combine似乎可以修复它。令人沮丧的问题,谢谢你的帮助