(view source code of selfile.vbs as plain text)
Option ExplicitWScript.Echo "Selected file: " & ChooseFile( )
Function ChooseFile( )
' Select File dialog based on a script by Mayayana' Known issues:' * Tree view always opens Desktop folder' * In Win7/IE8 only the file NAME is returned correctly, the path returned will always be C:\fakepath\' * If a shortcut to a file is selected, the name of that FILE will be returned, not the shortcut'sOn Error Resume Next
Dim objIE, strSelectedChooseFile = ""
Set objIE = CreateObject( "InternetExplorer.Application" )
objIE.visible = False
objIE.Navigate( "about:blank" )
Do Until objIE.ReadyState = 4
LoopobjIE.Document.Write "<HTML><BODY><INPUT ID=""FileSelect"" NAME=""FileSelect"" TYPE=""file""><BODY></HTML>"
With objIE.Document.all.FileSelect
.focus
.click
strSelected = .value
End With
objIE.Quit
Set objIE = Nothing
ChooseFile = strSelectedEnd Function
page last modified: 2025-10-11; loaded in 0.0089 seconds