How to get current working directory path c#?

后端 未结 7 1055
清歌不尽
清歌不尽 2020-12-15 15:08

I have a cursor file in project. I have given the absolute path in code i.e

F:/r.cur  

the problem is this is hard-coded path And i Want

7条回答
  •  星月不相逢
    2020-12-15 15:37

    System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName) at startup will give you the full path.

    After that, if you * really want to find something during development (as your comments in other answers point) *, first find the path using FileInfo(thestringwithfilenamepath).Directory.Name.

提交回复
热议问题