VB.NET, C#, PowerShellを使用しているエンジニアのためのサイト。
基本的な使用方法から開発で役立つTipsまで幅広く取り扱っています。
C#.NETでアプリケーションの実行パスを取得するにはSystem.AppDomain.CurrentDomain.BaseDirectoryを使用します。
using System.IO; : :省略 : private void button1_Click(object sender, System.EventArgs e) { // 変数を宣言する string strAppPath; // アプリケーションの実行パスを取得する strAppPath = System.AppDomain.CurrentDomain.BaseDirectory; // 取得したアプリケーションの実行パスを表示する MessageBox.Show("アプリケーション実行パスは[" + strAppPath + "]です"); }