如何使用 Process.Start 打开 word 文件(带空格的路径)?

Ahm*_*mad 1 c# process.start

该文件在目录中,但空格导致此错误:

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

给我看这条消息

和这个

小智 5

假设 Winword.exe 是 Word 文档的默认应用程序,您只需要在进程 Filename 属性中指定文档的路径,如下所示

        Process p = new Process();
        p.StartInfo.FileName = @"C:\Users\Someone\Documents\Path With Spaces\Word.docx";
        p.Start();
Run Code Online (Sandbox Code Playgroud)

在 Visual Studio 2015 社区版中测试