Get the startup path in a vb.net console exe

后端 未结 3 1856
半阙折子戏
半阙折子戏 2021-01-05 19:06

How do get the startup path ( system.windows.forms.application.StartupPath ) of my exe without adding a reference to system.windows.forms?

3条回答
  •  逝去的感伤
    2021-01-05 19:15

    You can get the startup path without reflection by using:

    IO.Path.GetDirectoryName(Diagnostics.Process.GetCurrentProcess().MainModule.FileName)
    

提交回复
热议问题