LoginSignup
2
2

More than 5 years have passed since last update.

プロジェクトファイル名取得

Last updated at Posted at 2015-09-11

プロジェクトファイル名(exeファイル名)取得方法

・Application.ExecutablePath プロパティを使う
・Path.GetFileNameメソッドを使う

手順)
1.System.Windows.Formsを参照追加して、usingで名前空間を指定

2.System.IO.Path.GetFileNameで取得したプロジェクトファイルからファイル名を取得する

サンプルコード

var path = System.Windows.Forms.Application.ExecutablePath;
var projectName = System.IO.Path.GetFileName(path);
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2