Ahmed Emad Ahmed Emad - 9 months ago 39
C# Question

How do I use Process.Start to open a word file (Path with Spaces)?

The file is in the directory but the spaces cause this error:

string outfile = @"C:\Users\hp\Desktop\New folder (4)\outFile.doc";
Process.Start("WINWORD.EXE", outfile);

Shows me this message



Provided that Winword.exe is your default application for Word documents, all you need is to specify your document's path in the process Filename property as follows

        Process p = new Process();
        p.StartInfo.FileName = @"C:\Users\Someone\Documents\Path With Spaces\Word.docx";

Tested in Visual Studio 2015 Community Edition