(Owed by: 春夜喜雨 http://blog.csdn.net/chunyexiyu 转载请标明来源)
在window7中,进入命令行cmd模式,输入set到多个系统目录定义:
例如:
Win7下:
APPDATA=c:\users\xxx\AppData\Roaming
LOCALAPPDATA=c:\users\xxx\AppData\Local
USERPROFILE=c:\users\xxx
ALLUSERPROFILE=c:\ProgramData
HOMEPATH=c:\users\xxx
TEMP= c:\users\xxx\AppData\Local \Temp
TMP= c:\users\xxx\AppData\Local \Temp
Xp下:
APPDATA=c:\ Documents and Setting\xxx\Application Data
无 LOCALAPPDATA
USERPROFILE= c:\ Documents and Setting \xxx
ALLUSERPROFILE=c:\Documents and Setting\Allusers
HOMEPATH=c: \Documents and Setting\xxx
TEMP=c:\DOCUME~1\xxx\LOCALS~1\Temp
TMP= c:\DOCUME~1\xxx\LOCALS~1\Temp
说明:
APPDATA-软件使用时用户的配置信息通常写到此
LOCALAPPDATA-临时目录通常创建到这里
ALLUSERPROFILE-通常软件的鉴权信息写入到
HOMEPATH-用户目录
TEMP/TMP- 临时文件夹,可以随时被清理
获取LOCALAPPDATA/
APPDATA/USERPROFILE /ALLUSERPROFILE:
CString sPath; SHGetFolderPath( sPath.ReleaseBuffer(); 类似还支持: |
获取临时目录TEMP/TMP:
// 获取临时文件夹 CString sTempPath; ::GetTempPath(MAX_PATH, sTempPath.ReleaseBuffer(); CString sTempFile; // 获取临时文件: ::GetTempFileName(sTempPath, sTempFile.ReleaseBuffer(); |
(Owed by: 春夜喜雨 http://blog.csdn.net/chunyexiyu 转载请标明来源)