-2

How to hide the command robocopy window in C#? I tried so:

startInfo.Arguments = "\"" + source + "\" " + "\"" + fold + "\"" + formats + "  /s /R:1 /W:5 /MT:12 /njh /njs /ndl /nc /ns /np /nfl";

this code doesn't work - the command window opens. I want that the command window not to open and robocopy worked "silently".

Filburt
  • 17,626
  • 12
  • 64
  • 115
  • 1
    Possible duplicate of [Hide console window from Process.Start C#](http://stackoverflow.com/questions/5377423/hide-console-window-from-process-start-c-sharp) – Filburt Nov 11 '15 at 19:40
  • It's not the same thing ! With Robocopy is not working ! – John Kuzin Nov 11 '15 at 20:03
  • Did you already try omitting all the logging switches? Did you also try setting `RedirectStandardOutput`, `UseShellExecute` and `CreateNoWindow` accordingly? If so, please update your post to make clear what you already tried. – Filburt Nov 11 '15 at 23:20

1 Answers1

0

Set the WindowStyle property.

p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
ElektroStudios
  • 19,105
  • 33
  • 200
  • 417