【发布时间】:2015-07-06 17:31:45
【问题描述】:
我正在尝试使用 C# 的 Process.Start() 在 Adobe 阅读器中打开 PDF 文件。
当我提供不带空格的路径时,它可以正常工作,但无法打开包含空格的路径和 pdf 文件。
这是我的代码:
Button btn = (Button)sender;
ProcessStartInfo info = new ProcessStartInfo();
info.FileName = "AcroRd32";
string s = btn.Tag.ToString();
//btn.Tag Contains the full file path
info.Arguments = s;
Process.Start(info);
如果是C:\\Users\\Manish\\Documents\\ms_Essential_.NET_4.5.pdf,它可以正常工作,但如果是F:\\Tutorials\\C#\\Foundational\\Microsoft Visual C# 2012 Step By Step V413HAV.pdf,Adobe Reader 会报错there was an error in opening the document file can't be found。
我在 SO 中阅读了许多与此主题相关的问题,但它不起作用。因为我不知道如何在我的字符串s 中应用@ 前缀。
任何想法如何解决这个问题?
【问题讨论】:
标签: c# pdf process.start