Problem parsing command line arguments containing "&" character in C # .Net
I am working in VisualStudio 2008 environment and developing a command line application in C # .Net. The application expects the path to be passed from a command line argument. I pass these arguments to my application by setting "Command Line Arguments" in the debug option of the project settings. The argument I presented is -> "D: \ Test \ C & ID \ Test data \ a.dbf"
class Program
{
static int Main(string[] args)
{
Console.WriteLine(args[0]);
return 0;
}
}
It works fine if I run the program using F5. The problem is I am using ctrl + F5. args[0]
contains
D:\Test\C^&ID\Test data\a.dbf
instead
D:\Test\C&ID\Test data\a.dbf
...
I can’t figure it out that this is how the '&' is preceded by the "^" character. Because of this, my path check fails. Can anyone explain this to me. (Note that the supplied arguments are enclosed in double quotes and the part contains the "&" character). And I think with this I have explained my problem :-)