如何将相对路径转换为绝对路径在Windows应用程序? [英] How to convert a relative path to an absolute path in a Windows application?

查看:468
本文介绍了如何将相对路径转换为绝对路径在Windows应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何转换为相对路径绝对路径在Windows应用程序?

How do I convert a relative path to an absolute path in a Windows application?

我知道我们可以在ASP.NET中使用使用Server.Mappath()。但是我们可以在Windows应用程序吗?

I know we can use server.MapPath() in ASP.NET. But what can we do in a Windows application?

我的意思是,如果有一个.NET的内置功能,可以处理的...

I mean, if there is a .NET built-in function that can handle that...

推荐答案

你试过:

string absolute = Path.GetFullPath(relative);



?注意,将使用过程中的当前工作目录,不包含的文件的目录。如果没有帮助,请澄清你的问题。

? Note that that will use the current working directory of the process, not the directory containing the executable. If that doesn't help, please clarify your question.

这篇关于如何将相对路径转换为绝对路径在Windows应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆