I am trying to open PDF files in Adobe reader using C#'s Process.Start()
.
When I provide a path without white spaces it works fine, but paths and pdf files containing white spaces don't open.
This is my code:
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);
If it is C:\\Users\\Manish\\Documents\\ms_Essential_.NET_4.5.pdf
it works fine but if it is F:\\Tutorials\\C#\\Foundational\\Microsoft Visual C# 2012 Step By Step V413HAV.pdf
Adobe Reader gives an error saying there was an error in opening the document file can't be found
.
I have read through many questions related to this topic in SO but it won't work. As I can't figure out how to apply @
prefix in my string s
.
Any ideas how to fix this?