I am using C# in Windows 11.
PhotoViewer is the default app for AVI files on my PC. I am trying to launch PhotoViewer with an AVI file using the "Process.Start" method as follows:
MessageBox.Show(fn + " exists? " + File.Exists(fn));
Process.Start("@" + fn);
The MessageBox output is "d:\dscf0001.avi exists? true."
Process.Start throws a Win32Exception with the message "The system cannot find the file specified."
What am I doing wrong?
I guess you have read from the internet, something like
They put the
@at the beginning because the character\is the escape character and it needs to be disabled by @.Refer:
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/verbatim
https://www.tutorialsteacher.com/csharp/csharp-string
In your case, you don't need it.