command line Start.Info.Argument error

196 views Asked by At

I would like run this command with C# :

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

I have this code (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();

Error:

'C:\Program' is not recognized as an internal command or external command

I don't understand because without C#, it works.

Can you help me ?

1

There are 1 answers

7
Nissim On BEST ANSWER

Usually, path environments (%windir%, %temp%, etc) uses backslashes (\). try modifying your arguments to use backslashes instead of slashes (\"%WIX% \ bin \ heat.exe\"...