|
using System;
using System.IO;
// ********************************************************
// * 実行
// ********************************************************
public class App
{
public static void Main() {
// PATH 環境変数取得
String strEnv = Environment.GetEnvironmentVariable( "PATH" );
// 配列定義
String delimStr = ";";
Char[] delimiter = delimStr.ToCharArray();
String[] split = null;
// トークン分割
split = strEnv.Split( delimiter );
// ソート
Array.Sort( split, split.GetLowerBound(0), split.Length );
// 書き込み
try {
StreamWriter OutFile = new StreamWriter( @".\result.txt", false );
foreach (String strValue in split) {
OutFile.WriteLine( strValue );
}
OutFile.Flush();
OutFile.Close();
}
catch( Exception e ) {
Console.WriteLine("エラーの内容 : {0}", e.ToString());
}
}
}
| |