Skip to content

Instantly share code, notes, and snippets.

@codeartery
codeartery / BrowseForFile.vbs
Last active September 8, 2024 10:19
Browse for file dialog in VBScript that allows filtering by type.
Function BrowseForFile()
REM@description
' HTML based browse for file dialog that doesn't require a temporary file.
REM@returns
' BrowseForFile <string> - The file path of the selected file.
REM@author
' Jeremy England, http://codeartery.com/
REM@mini
' Function BrowseForFile():BrowseForFile=CreateObject("WScript.Shell").Exec("mshta.exe ""about:<input type=file id=f><script>resizeTo(0,0);f.click();new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(f.value);close();</script>""").StdOut.ReadLine():End Function