C# Executable Executing directory

前端 未结 8 1999
庸人自扰
庸人自扰 2020-12-11 02:38

What is the best method of getting the path the C# executable is running from?

I need to use it for temp folders etc and currently I\'m using:

Path.G         


        
8条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-11 03:16

    string executableLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string txtfile = Path.Combine(executableLocation, "example.txt");

提交回复
热议问题