2012-07-06 23 views
0

当我们将Documents and Settings文件夹完全从C移动到D驱动器时,产品插件安装不起作用,最终出现弹出窗口窗口分割(0):C和错误文件夹不存在?对于具有单个分区的系统,这是工作正常,但只适用于多个分区,这是行不通的移动文件夹结构的安装脚本问题

这里是安装脚本中使用的vbscript代码的位,我需要做任何修改?

Dim windowsFolder  ' For finding shortcut location 
Dim windowsFolderSplit ' For isolating the WINDOWS drive 

windowsFolder = fso.GetSpecialFolder(WindowsFolder) 
If DEBUG = "D1" Then   
    MsgBox "windowsFolder:" & windowsFolder 
End If 

windowsFolderSplit = Split(windowsFolder, "\", -1, 1) 

If DEBUG = "D1" Then   
    MsgBox "windowsFolderSplit(0):" & windowsFolderSplit(0) 
    MsgBox "windowsFolderSplit(1):" & windowsFolderSplit(1) 
End If 

Set docAndSetFolder = fso.GetFolder(windowsFolderSplit(0) & "\Documents and Settings") 

它是否硬编码到'C'驱动器?

+0

你是什么意思与 “产品附加” 到底是什么? – reporter 2012-07-06 11:28:50

+0

@reporter是我的产品补丁。产品工作正常,但当我开始补丁安装它扔这一个。该vbscript是补丁安装的一部分,是否硬编码到'C'驱动器? – vettori 2012-07-06 11:33:51

+1

是的,“空间窗口文件夹”通常是指向硬盘上特定路径的链接。 – reporter 2012-07-06 12:09:40

回答

1

SpecialFolders(MSDN):

Dim objShell As Object 
Dim strPath As String 

Set objShell = Wscript.CreateObject("Wscript.Shell") 
strPath = objShell.SpecialFolders("MyDocuments") 
wscript.echo strPath 

或可选:

Set S = CreateObject("WScript.Shell") 
Set E = S.Environment 
WScript.Echo E("USERPROFILE") 
+0

如果这个代码只存在于D文件夹中而不是C中,这个代码将获取Documents and Settings文件夹吗? – vettori 2012-07-09 10:46:00

+0

第一个代码将获得MSDN文章中列出的特殊文件夹,而不管它们在哪里。第二个代码获取环境变量 - 在命令行输入“SET”,查看哪些变量是打开的以便返回 – SeanC 2012-07-09 13:06:29