windows vbscript 中的 CommonAppData
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/295303/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
CommonAppData in vbscript
提问by Mephisztoe
A customer's application "AppName" has its configuration files stored in CommonAppData.
客户的应用程序“AppName”的配置文件存储在 CommonAppData 中。
- Under Windows XP that is
C:\Documents and Settings\All Users\Application Data\AppName
- Under Windows Vista that is
C:\ProgramData\AppName
- 在 Windows XP 下是
C:\Documents and Settings\All Users\Application Data\AppName
- 在 Windows Vista 下是
C:\ProgramData\AppName
How do I get the correct foldername with VBScript?
如何使用 VBScript 获取正确的文件夹名称?
回答by Tomalak
Const CommonAppData = &H23& ' the second & denotes a long integer '
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(CommonAppData)
Set objFolderItem = objFolder.Self
MsgBox objFolderItem.Name & ": " & objFolderItem.Path
The MSDN holds a page that lists the other Shell Special Folder Constants.
MSDN 上有一个页面列出了其他Shell 特殊文件夹常量。
This page is nice, too: Enumerating Special Folders, part of the Microsoft Windows 2000 Scripting Guide. (Link is now defunct, but the Internet Archive still has a copy.)
这个页面也不错:枚举特殊文件夹,Microsoft Windows 2000 脚本指南的一部分。(链接现已失效,但Internet Archive 仍有副本。)