在C#中,我可以执行以下操作:
DirectoryInfo di = new DirectoryInfo(System.Environment.GetEnvironmentVariable("ALLUSERSPROFILE"));
Run Code Online (Sandbox Code Playgroud)
这将为我提供所有用户个人资料的路径.
在C++中,我可以使用SHGetFolderPath,但似乎并没有为所有用户提供CSLID.是否有一个equlivant函数,我可以将%ALLUSERSPROFILE%吹出它的路径值?
Kir*_*sky 10
使用SHGetFolderPath
带CSIDL_COMMON_APPDATA
.或者SHGetKnownFolderPath
自Vista以来FOLDERID_ProgramData
.
或者,使用.NET native Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)