用户目录的路径获取 [英] Obtaining path of users directory

查看:131
本文介绍了用户目录的路径获取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获得路径的用户从MS Windows Vista的服务文件夹?
我想的C路径:\Users 目录,但也可能是不同的位置取决于系统的国产化

How to get path of Users folder from windows service on MS Vista? I think about path of C:\Users directory, but it may be different location depend on system localization.

推荐答案

看看在环境.SpecialFolder枚举,如:

 Environment.GetFolderPath(Environment.SpecialFolder.CommonDesktopDirectory);



调整所需的特殊文件夹。然而,在读另一篇文章发现这里 ,它看起来像你可能需要做字符串的操作一点,如果你想确切的 C:\users 的代替的 C:\users\public ,例如

Adjust for the special folder you want. However, in reading another post found here, it looks like you may need to do a little manipulation of the string if you want exactly c:\users instead of c:\users\public, for example.

这篇关于用户目录的路径获取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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