I wrote a small application to copy files from source to destination. I expected two parameters, source and destination. The following command works fine.
test.exe "C:\source path" "D:\destination"
The problem I have is when I pass the parameter within "
and end it with \
then it messes up.
For example:
test.exe "C:\source path\" "D:\destination"
Since \
is an escape character then test.exe gets the first argument as C:\source path"
instead of C:\source path\
So, what's the proper way to deal with this problem.
Even the most basic sample shows that strange behavior - \"
passed from command line get converted into "
:
static void Main(string[] args)
{
foreach(var s in args)
{
System.Console.WriteLine(s);
}
}