[VC2005]カレントフォルダを取得する方法

◆概要

カレントドライブのカレントフォルダを取得するには、Dirrectory.GetCurrentDirectoryメッソッドを利用します。

◆Dirrectory.GetCurrentDirectoryメッソッド

カレントドライブをj変更するには、Directory.SetCurrentDirectoryメッソッドを利用します。

using System.IO;

 private void button1_Click(object sender, EventArgs e)
        {
            string currentFolder;
            //カレントフォルダを取得
             currentFolder = Directory.GetCurrentDirectory();

            //メッセージボックスでカレントフォルダを表示
             MessageBox.Show(currentFolder, "カレントフォルダ",
                MessageBoxButtons.OK, MessageBoxIcon.Information);
        }


▼ページトップへ