Con este método, podremos seleccionar archivos con nuestro VBScript, lo haremos haciendo una llamada a Internet Explorer, y este nos dara la ruta del archivo (sin el fakepath).
- Abrimos el Bloc de Notas
— Copiamos este texto:
Set WshShell = CreateObject("WScript.Shell")
On Error Resume Next
incluir1 = WshShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3\160A")
On Error Resume Next
incluir2 = WshShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3\CurrentLevel")
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3\160A", "0", "REG_DWORD"
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3\CurrentLevel", "0", "REG_DWORD"
Dim Result
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Visible = False
.Navigate("about:blank")
Do Until .ReadyState = 4 : Loop
With .Document
.Write "<html><body><input id='f' type='file'></body></html>"
With .All.f
.Focus
.Click
Result = .Value
End With
End With
.Quit
End With
Set IE = Nothing
MsgBox Result
If incluir1 <> "" Then
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3\160A", incluir1, "REG_DWORD"
End If
If incluir2 <> "" Then
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3\CurrentLevel", incluir2, "REG_DWORD"
End If
- Lo guardamos con extensión ".vbs"