long filename argument in dotNet application
Posted on 2009-05-19
I am writing a dotNet application. This application accepts argument in the Main function. I want to be able to drag and drop a file onto this application. When the file has a normal filename (ie without space), everything works fine. When the file has a long filename with space, then I want the filename to be considered as one argument surrounded with double quotes (ie not 2 arguments when there is a space in the filename).
This dotNet application may have switches.
One example is when I create a *.bat file. When I drag and drop another file onto this *.bat file, the %1 argument contains a filename surrounded by double quotes.
How can I achieve this in dotNet?