无法使用shell中的BrowseForFolder浏览注册表文件

时间:2018-02-27 15:26:02

标签: shell vbscript

我无法在shell中使用BrowseForFolder浏览注册表(.reg)文件,它会抛出错误80004005,但当我选择excel和其他文档时,BrowseForFolder工作正常。这是我的代码

regKey = "HKEY_LOCAL_MACHINE\Software\securezip"
RegFile1 = Join(Array(Month(now()),"-",Day(now()),"-",Year(now()),"_IRIScope_backup.reg"))
regFile2 = Replace(RegFile1," ","")
regFile = "C:\maspects\Env_Automation\"&regFile2
                        *emphasized text*
 React = msgbox("Press Yes to Restore the Registry,No to Backup the registry",3,"Select the option")
 if React = 6 then
    Wscript.echo "Inside 6"
    Set file = shell.BrowseForFolder(0,"Choose a file:",&H4000,17)
    Wscript.echo file
    wscript.sleep 1000*4
    BrowseForFile = file.self.path
    regCmd = "REG IMPORT "& BrowseForFile &""
    oShell.Run regCmd, 0, True
 ElseIf React = 7 then
 Set fso = CreateObject("Scripting.FileSystemObject")
 regCmd = "regedit.exe /E "&regFile &" "& regKey &""
 oShell.Run regCmd, 0, True
End If

0 个答案:

没有答案