C# main and Spacey paths - Kindo of an silly one!

I have an application that will take 2 parameters both of them paths. i came across a bug in my code that im not sure how to fix

From the title you can guess that its something to do with spacey paths.

Is there anyway (without having to put quotes around the path) of getting the whole path and not just a partial path if it contains spaces.
Who is Participating?
No, if you don't include the quotes around the path, the space means "next parameter", so your application will have more parameters, all of them parts of files but you cannot know where the first one ends and where the second one starts.
However, if you know what the paths are to be like, you can combine 3 or more parameters you get into 2 paths. For example, if you know that you are getting 2 paths none of which has more then 1 consequtive space, and you have received 5 parameters, then you can get only 4 different sets of possible values.

You may create a function that assignes some score to each variant and select the one with the top score, or you may test if a path exists if it should, and so on....

If paths should exist, you can try to append parameters one by one: get the list of entries in the current directory and see if you can create a valid entry adding the next parameter separated by arbitrary number of spaces.

So, if there is no additional data on the paths, then the answer is NO. If there is such data, the answer is MAYBE YES.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.