2012-07-06 76 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