/// Copyright(c) 2016 pakkin. All Rights Reserved. /// [改訂履歴] /// 2016.01.25 作成 using System; using System.IO; using System.Linq; using Microsoft.VisualBasic.FileIO; // Microsoft.VisualBasic - 参照設定を追加 namespace ConsoleApplication1 { class Program { private static string[] DivideCmdLine(string cmdLine) { using (StringReader sr = new StringReader(cmdLine)) using (TextFieldParser fp = new TextFieldParser(sr)) { fp.Delimiters = new string[] { " " }; return fp.ReadFields().Where(x => x.Length > 0).ToArray(); } } static void Main(string[] args) { string[] cmdArgs = DivideCmdLine(" \"C:\\Hoge Hoge\\hoge.exe\" \"C:\\Hoge Hoge\\hoge1.txt\" \"C:\\Hoge Hoge\\hoge2.txt\" "); Console.Write(string.Join(Environment.NewLine, cmdArgs)); Console.ReadKey(); } } }
Copyright(c) 2014-2022 pakkin. All Rights Reserved.