【问题标题】:command line Start.Info.Argument error命令行 Start.Info.Argument 错误
【发布时间】:2015-06-16 09:05:32
【问题描述】:

我想用 C# 运行这个命令:

"%WIX%/bin/heat.exe" 目录 "C:\Documents and Settings\APP" -gg -sfrag -cg Appli -out wixappli.wxs

我有这个代码(Program.cs):

System.Diagnostics.Process process1 = new System.Diagnostics.Process();
process1.StartInfo = new System.Diagnostics.ProcessStartInfo("cmd.exe");
process1.StartInfo.Arguments = String.Format("/k \"%WIX%/bin/heat.exe\" dir \"{0}\" -gg -sfrag -cg Appli -out wixappli.wxs ",
@"C:\Documents and Settings\APP");
process1.StartInfo.WorkingDirectory = @"C:\Documents and Settings\test";
process1.StartInfo.CreateNoWindow = true;
process1.StartInfo.ErrorDialog = false;
process1.Start();

错误:

'C:\Program' 未被识别为内部命令或外部命令 命令

我不明白,因为没有 C#,它可以工作。

你能帮帮我吗?

【问题讨论】:

    标签: c# command-line wix heat


    【解决方案1】:

    通常,路径环境(%windir%、%temp% 等)使用反斜杠 (\)。尝试修改您的参数以使用反斜杠而不是斜杠 (\"%WIX% \ bin \ heat.exe\"...

    【讨论】:

    • 不,我试过了,但它不起作用。但是没有 C# 它可以与 /bin/heat.exe 一起使用。这很奇怪
    • 打开 cmd 并执行:'echo %wix%'。结果如何?
    • 我有 C:\Program Files\WiX Toolset v3.9\
    • 请注意它以反斜杠结尾。代替 "%WIX%/bin,使用 "%WIX%bin
    • 我相信双引号会有所帮助。尝试: String.Format("/k \"\"%WIX%/bin/heat.exe\" dir \"{0}\" -gg -sfrag -cg Appli -out wixappli.wxs\"",@" C:\Documents and Settings\APP");
    猜你喜欢
    • 2021-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-22
    • 2011-07-04
    • 2016-08-31
    • 1970-01-01
    相关资源
    最近更新 更多