Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

illegal character in path

Tags:

c#

I am trying to get to a file located in

C:\Program Files (x86)\test software\myapp\demo.exe

In VS debugger i see the path as:

"\"C:\\\Program Files (x86)\\\test software\\\myapp\\\demo.exe\""

when i print it out i see in console :

"C:\Program Files (x86)\test software\myapp\demo.exe"

but when i try something like

FileInfo fi = new FileInfo(PathMentionedAbove); 

i get Illegal character in path.

What is wrong? the file exists and path is correct. what's illegal above this path?

any help would be appreciated.

like image 878
ke3pup Avatar asked Jul 23 '10 07:07

ke3pup


1 Answers

Your path includes " at the beginning and at the end. Drop the quotes, and it'll be ok.

The \" at the beginning and end of what you see in VS Debugger is what tells us that the quotes are literally in the string.

like image 140
Jay Allard Avatar answered Oct 10 '22 04:10

Jay Allard