I need to open folder through windows explorer using C#. It is working fine untill there is comma in folder path. Here is an example:
System.Diagnostics.Process.Start("explorer.exe", "C:\\folder\\another-folder\\123,456");
The error is: The path '456' does not exist or it is not a directory.
Any solution please :)
Yes. Commas and dots are fine.
Punctuation, symbols, or special characters (periods, commas, parentheses, ampersands, asterisks, etc.) should be avoided.
A path is a slash-separated list of directory names followed by either a directory name or a file name. A directory is the same as a folder.
Try adding double quotes around your path:
System.Diagnostics.Process.Start("explorer.exe", "\"C:\\folder\\another-folder\\123,456\"");
Side-note: you might find it easier to write paths using a verbatim string literal, to avoid having to escape the slashes:
System.Diagnostics.Process.Start("explorer.exe", @"""C:\folder\another-folder\123,456""");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With