欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  web前端

Locate a File Using a File Open Dialog Box_javascript技巧

程序员文章站 2022-03-16 22:22:37
...
Demonstration script that displays a File Open dialog box (open to the folder C:\Scripts), and then echoes back the name of the selected file. Supported Platforms

Windows Server 2003
No

Windows XP
Yes

Windows 2000
No

Windows NT 4.0
No

Windows 98
No


Script Code

复制代码 代码如下:

Set objDialog = CreateObject("UserAccounts.CommonDialog")

objDialog.Filter = "VBScript Scripts|*.vbs|All Files|*.*"
objDialog.FilterIndex = 1
objDialog.InitialDir = "C:\Scripts"
intResult = objDialog.ShowOpen

If intResult = 0 Then
Wscript.Quit
Else
Wscript.Echo objDialog.FileName
End If