Muni Bus

パソコンの操作方法や設定方法を忘れないようにメモしています。ブログを一回引っ越ししているので、所々表示がかなり乱れています・・・

【Visual Basic】実行中のプログラムのフルパス、プログラムが置かれているフォルダーを得る

System.Windows.Forms.Application.ExecutablePathとSystem.Windows.Forms.Application.StartupPathを使えばよい。

例として、C:\DEMO\program.exeというプログラムで実行した場合、以下のようになる。

Console.WriteLine(System.Windows.Forms.Application.ExecutablePath)

C:\DEMO\program.EXE

Console.WriteLine(System.Windows.Forms.Application.StartupPath)

C:\DEMO