Windows应用程序数据目录 [英] Windows application data directory

查看:546
本文介绍了Windows应用程序数据目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用环境变量%allusersprofile%,我可以获取存储通用设置的目录。但是大多数程序将其设置存储在子文件夹 anwendungsdaten(德语,应用程序数据)中。有没有办法获取此文件夹的直接路径?问题在于它的名称取决于语言。
谢谢。

With the environment variable %allusersprofile% I can get the directory where common settings are stored. But most programs store their settings in the sub-folder "anwendungsdaten" (German, application data). Is there a way to get the direct path to this folder? The problem is that its name is language dependent. Thanks.

推荐答案

不确定您使用的是哪种编程语言,因此我假设使用基本的Windows api。在XP中,您可以使用CSIDL_COMMON_APPDATA调用 SHGetFolderPath 参数。看来Vista和7具有新功能集做同样的事情,您可能想调用 SHGetKnownFolderPath

Not sure about what programming language you're using, so I'll assume the basic Windows api. In XP you can call SHGetFolderPath with CSIDL_COMMON_APPDATA as a parameter. It looks like Vista and 7 have a new set of functions that do the same thing, you'd probably want to call SHGetKnownFolderPath.

Windows窗体,则可以使用Application.UserAppDataPath属性。

In Windows Forms, you can use the Application.UserAppDataPath property.

这篇关于Windows应用程序数据目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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