I am working in VisualStudio 2008 environment and developing a commandline application in C#.Net. The application expects a path to be passed from the commandline argument. I am passing these arguments to the to my application by setting the "Command line arguments" in the debug option of the project setting. The argument I provided 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. Problem is when I use ctrl+F5. The args[0]
contains
D:\Test\C^&ID\Test data\a.dbf
instead of
D:\Test\C&ID\Test data\a.dbf
.
I am not able to grasp this that how come '&' is preceded by a '^' symbol. Further my path validation fails due to this. Can anyone please explain this to me. (Please note that the arguments provided are enclosed in double quotes and a part of it contains '&' character) And I think with this I have explained my problem :-)