我正在使用以下VBSript並且工作正常,但是當我嘗試將其添加到創建的.hta應用程序時,它無法正常工作。小型VBScript在HTA中不起作用
首先,「strValue的」不中MSGBOX顯示其次腳本錯誤出現如「類型不匹配:fso.FolderExists'」
任何幫助,因爲我一直在努力將不勝感激想出解決辦法。
sub LyncFix
dim oReg, strKeyPath, strValueName, strValue, oWS, userProfile
Const HKEY_LOCAL_MACHINE = &H80000002
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\C7376A18AE70EB645A6EA7E5F5CE44F9"
strValueName = "71B0EB18B3654D541B8975126E6C56DC"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
MsgBox "Folder required to resolve Lync Install prompt: " & strValue
Dim fso
Dim Folder
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FolderExists(strValue)) Then
MsgBox("The folder '" + strValue + "' already exists")
end If
If NOT (fso.FolderExists(strValue)) Then
' Delete this if you don't want the MsgBox to show
MsgBox("Local folder doesn't exist, creating...")
' Create folder
MsgBox("'" + strValue + "'" + " created")
fso.CreateFolder(strValue)
MsgBox("Please now try launching Lync again")
End If
end sub
1.我沒有看到'strComputer'值; 2.將'&vbNewLine&VarType(strValue)&vbTab&TypeName(strValue)'添加到第一個'MsgBox'。然後你可以看到指示_variant_子變量類型信息的值(數字和字符串形式) – JosefZ 2015-03-13 09:56:34
道歉,我應該說我已經在hta中早些時候在同一個vbscript中定義了strComputer。對我評論整個hta會有好處嗎? – jERCle 2015-03-14 10:24:41