views:

378

answers:

1

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 :-)

+1  A: 

Just checking -- you know that there is a different set of command line arguments per configuration, right?

So the command-line args in debug config (F5) might be different to the args in release config (ctrl+F5).

Ed Guiness
Thanks for reply.Can u please elaborate this more. By the way, I have checked with both sets you mentioned - debug and release.