c# - Process, appcmd and arguments format error. Why? -
I found this error: Failed to process input: starting with parameter 'C: \ test.xml' Should a / or - (HRESULT = 80070057)
I am trying to export my IIS websites with APCMD, but I can not use this command in C #, but if I manually copy it to CMD Exe this work "list site / config / xml> c: \ test.xml", I also tried "list site / config / xml> c: / test. Xml"
var pro2 = new process (); Pro2.StartInfo.FileName = "C: \ Windows \ System32 \ inetsrv \ appcmd.exe"; Pro2.StartInfo.Arguments = "list site / config / xml> C: /test.xml"; Pro2.StartInfo.CreateNoWindow = true; Pro2.StartInfo.UseShellExecute = false; Pro2.StartInfo.LoadUserProfile = True; Pro2.StartInfo.RedirectStandardOutput = True; Pro2.Start (); EventLog.WriteEntry (pro2.StandardOutput.ReadToEnd ()); Pro2.WaitForExit (); Pro2.Close ();
What do I do wrong?
Save characters in C #, especially "\".
Use a double backslash or @.
Comments
Post a Comment