P
Philip Semanchuk
Hi all,
Dotnet seems to be misparsing my command line args and I'd like to hear
about other people's experience with this. Everything is fine until I
mix backslashes and quotes in the args to my console app, e.g.:
myapp "c:\program files\" /foo /bar
Dotnet interprets the backslash preceding the quote as an escape
character with the result that args[0] comes through with the arguments
treated as one long string and the leading quote and second backslash
stripped, as follows:
c:\program files" /foo /bar
Other apps seem to handle such arguments as I expect. For instance, if I
start Word with this command line:
winword "c:\program files\"
Word responds with the error message that it can't open the file
C:\PROGRAM FILES\ which means it correctly interpreted the backslash as
a part of the path, and not as an escape character. Notepad behaves
similarly. In my opinion, this is a bug in Microsoft's Dotnet
implementation. Opinions appreciated.
I tried this under both C# and VB using both the args[] array passed in
through Main() and also with System.EnvironmentGetCommandLineArgs();
same results in all contexts. It'd be interesting to try this using Mono
under Linux where backslash isn't the path separator.
Thanks
Philip
Dotnet seems to be misparsing my command line args and I'd like to hear
about other people's experience with this. Everything is fine until I
mix backslashes and quotes in the args to my console app, e.g.:
myapp "c:\program files\" /foo /bar
Dotnet interprets the backslash preceding the quote as an escape
character with the result that args[0] comes through with the arguments
treated as one long string and the leading quote and second backslash
stripped, as follows:
c:\program files" /foo /bar
Other apps seem to handle such arguments as I expect. For instance, if I
start Word with this command line:
winword "c:\program files\"
Word responds with the error message that it can't open the file
C:\PROGRAM FILES\ which means it correctly interpreted the backslash as
a part of the path, and not as an escape character. Notepad behaves
similarly. In my opinion, this is a bug in Microsoft's Dotnet
implementation. Opinions appreciated.
I tried this under both C# and VB using both the args[] array passed in
through Main() and also with System.EnvironmentGetCommandLineArgs();
same results in all contexts. It'd be interesting to try this using Mono
under Linux where backslash isn't the path separator.
Thanks
Philip