当前位置:编程学习 > JS >>

Locate a File Using a File Open Dialog Box

答案: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

上一个:Add a Table to a Word Document
下一个:use jscript Create a SQL Server database

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,