【问题标题】:Running silent install with iss response file使用 iss 响应文件运行静默安装
【发布时间】:2019-07-31 17:01:47
【问题描述】:

我需要运行 cmd 命令以静默方式安装带有响应文件的软件,但我找不到正确的语法并一直出现“找不到指定路径”错误

我尝试在不使用 /s 和 /f1 参数的情况下运行它,它成功了。我也可以成功启动这两个文件,所以它不是来自它们的路径。 我也试过把exe和iss文件放到程序文件夹里去掉相对路径,但还是出现同样的错误...


string command = "\"\"Executable Folder Path\\setup.exe\"\" /s /f1\"\"Config Path\\conf_file.iss\"\"";
ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd", "/c " + command);

procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = false;

using (Process process = new Process())
{
    process.StartInfo = procStartInfo;
    process.Start();

    process.WaitForExit();

   string result = process.StandardOutput.ReadToEnd();
   Console.WriteLine(result);
}

请问有人知道正确的语法吗?

【问题讨论】:

  • 这些参数特定于setup.exe。我们不可能知道它们是什么。如果您可以从命令行运行 exe,那么这只是将调用移植到 c# 的问题。顺便说一句,您不需要在 c# 中运行 cmd /c。
  • 不,对于您要使用 iss 文件静默安装的每个软件,它们始终相同:silentinstall.org/InstallShield /s 用于静默安装,/f1 参数用于使用配置文件你的意思是我可以简单地用 Console.WriteLine() 写我的命令?

标签: c# file process console


【解决方案1】:

这应该让您的流程开始:

var setupExe = "Full/Path/To/setup.exe";
var configIss = "Full/Path/To/config.iss";
var procStartInfo = new ProcessStartInfo(setupExe);
procStartInfo.WorkingDirectory = Path.GetDirectoryName(setupExe);
procStartInfo.Arguments = $"/s /f1\"{configIss}\"";

【讨论】:

    猜你喜欢
    • 2013-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-04
    • 2020-03-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多