在VBS中获取Common Documents文件夹 [英] get Common Documents folder in VBS
问题描述
令我非常恼火的是,我必须使用VBS编写InstallShield 2010 LE自定义操作.我没有VBS经验,所以基本上是将我发现的代码段放在一起.
To my great chagrin, I must use VBS to write an InstallShield 2010 LE custom action. I have no VBS experience so I'm basically putting together code snippets that I find.
我需要保留Common Documents文件夹(CSIDL_COMMON_DOCUMENTS).它没有在WScript.Shell.SpecialFolders
中定义(尽管所有用户桌面"已定义).我找到了一些尝试链接到系统DLL的示例代码:
I need to get a hold of the Common Documents folder (CSIDL_COMMON_DOCUMENTS). It's not defined in WScript.Shell.SpecialFolders
(although All Users Desktop is). I found some example code that tries to link to a system DLL:
Private Declare Function SHGetFolderPath Lib "shfolder.dll" _
Alias "SHGetFolderPathA" _
(ByVal hwndOwner As Long, _
ByVal nFolder As Long, _
ByVal hToken As Long, _
ByVal dwReserved As Long, _
ByVal lpszPath As String) As Long
但是当我尝试在VbsEdit中运行它时,在第一行出现以下错误:
But when I try to run it in VbsEdit, I get the following error on the first line:
Microsoft VBScript compilation error: Expected end of statement
有什么想法吗?