Command line arguments, paths with spaces, parsing incorrectly

后端 未结 3 1914
被撕碎了的回忆
被撕碎了的回忆 2021-01-25 02:22

I have an issue that\'s nearly identical to the one outlined here (Console app not parsing correctly args with white spaces) but that answer has no bearing on my situation.

3条回答
  •  遇见更好的自我
    2021-01-25 02:27

    Try this, Join the args into a string again, then Split that string on the double quote character.

    string parms = String.Join(" ", args);
    string[] arguments = parms.Split('\"');
    ...
    

    BTW: This is a work around for the problem John Koerner has explained.

提交回复
热议问题