vbscript中的CommonAppData [英] CommonAppData in vbscript

查看:132
本文介绍了vbscript中的CommonAppData的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

客户的应用程序"AppName"的配置文件存储在CommonAppData中.

A customer's application "AppName" has its configuration files stored in CommonAppData.

  • 在Windows XP下,为C:\Documents and Settings\All Users\Application Data\AppName
  • 在Windows Vista下,为C:\ProgramData\AppName
  • Under Windows XP that is C:\Documents and Settings\All Users\Application Data\AppName
  • Under Windows Vista that is C:\ProgramData\AppName

如何使用VBScript获取正确的文件夹名称?

How do I get the correct foldername with VBScript?

推荐答案

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

MSDN拥有一个页面,其中列出了其他 Shell特殊文件夹常量.

The MSDN holds a page that lists the other Shell Special Folder Constants.

此页面也很好:枚举特殊文件夹,它是《 Microsoft Windows 2000脚本指南》的一部分. (链接现已失效,但

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.)

这篇关于vbscript中的CommonAppData的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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