gpt4 book ai didi

c# - 从文件名获取路径

转载 作者:行者123 更新时间:2023-11-30 22:23:46 25 4
gpt4 key购买 nike

所以我有一个文件(例如 index.html),我想获取它的路径。我的大部分文件都存储在 debug- 文件夹中。所以例如我想得到路径:

C:\documents and settings\administrator\My Documents\Visual Studio 2010\Projects\WebServer\WebServer\bin\Debug\index.html

我已经尝试过 Path.GetDirectoryname(filename);//不起作用,因为我没有得到任何返回

最佳答案

Path.GetFullPath(fileName);

关于c# - 从文件名获取路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13230583/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com