Console app not parsing correctly args with white spaces

.net, c#, command-line-arguments, console-application

Solution

Make sure the character you are typing is indeed the double quote ".

Maybe it's a character that looks like it.

I know my Greek language settings produce a " but it's not read that way.

Problem

I've created a .NET console application that gets some command line arguments. When I pass args with white spaces, I use quotes to embrace these arguments so that they are not splitted by cmd: ``` C:\MyAppDir> MyApp argument1 "argument 2" "the third argument" ``` If I execute the app in Windows XP it works fine: it gets 3 arguments: - argument1 - argument 2 - the third argument However, if i execute it in Windows Server 2008 it seems to ignore quotes: it gets 6 arguments: - argument1 - "argument - 2" - "the - third - argument" Any ideas why? NOTE: I printed arguments just when Main starts execution using this code: ``` Console.WriteLine("Command line arguments:"); foreach (string arg in args) { Console.WriteLine("# " + arg); } ```

Original source