【问题标题】:Installation script issue for shifting folder structure转换文件夹结构的安装脚本问题
【发布时间】:2012-07-06 11:22:25
【问题描述】:

当我们将 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”驱动器中?

【问题讨论】:

  • “产品插件”到底是什么意思?
  • @reporter 我的意思是产品补丁。产品工作正常,但是当我开始安装补丁时,它抛出了这个。 vbscript 是补丁安装的一部分,它是否将值硬编码到“C”驱动器中?
  • 是的,“空间窗口文件夹”通常是指向硬盘上特定路径的链接。

标签: vbscript windows-xp installation


【解决方案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")

【讨论】:

  • 如果文档和设置文件夹仅存在于 D 文件夹中而不存在于 C 中,此代码是否会获取该文件夹?
  • 第一个代码将获取 MSDN 文章中列出的特殊文件夹,无论它们在哪里。第二段代码获取环境变量——在命令行中输入SET,查看哪些变量是开放返回的
猜你喜欢
  • 2010-10-01
  • 2014-07-11
  • 1970-01-01
  • 1970-01-01
  • 2021-05-08
  • 1970-01-01
  • 2011-01-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多