0

当我们将 Documents and Settings 文件夹从 C 盘完全移动到 D 盘时,产品插件安装不工作,最终弹出 windowsFolderSplit(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”驱动器中?

4

1 回答 1

1

特殊文件夹(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")
于 2012-07-06T20:09:42.717 回答