Maybe it's good stuff.--windows Script host-2[Browse folder]

Source: Internet
Author: User
Tags copy
Window ' ************************************************
' File:Dialog.vbs (WSH sample in VBScript)
' Author: (c) G. Born
'
' Using the Shell dialog box to select a folder
'************************************************
Option Explicit

' Flags for the options parameter
Const Bif_returnonlyfsdirs = &h0001
Const Bif_dontgobelowdomain = &h0002
Const Bif_statustext = &h0004
Const bif_returnfsancestors = &h0008
Const Bif_editbox = &h0010
Const bif_validate = &h0020
Const Bif_browseforcomputer = &h1000
Const Bif_browseforprinter = &h2000
Const bif_browseincludefiles = &h4000

Dim WSH, Objdlg, OBJF

' Get Application object of the Windows shell.
Set Objdlg = WScript.CreateObject ("Shell.Application")

' Use of the BrowseForFolder method.
' for Instance:set OBJF = Objdlg.browseforfolder _
' (&h0, "Select the folder to copy", &h10, "C:\Born")

Set OBJF = Objdlg.browseforfolder (&h0, _
"Select the folder to copy", _
Bif_editbox + bif_returnonlyfsdirs)

' Here we use the ' the ' the ' the ' the ' Detect '
If Isvalue (OBJF) Then
MsgBox "Selected folder:" & Objf.title
Else
MsgBox "Canceled"
End If

' Here we use TypeName to detect the result.
If InStr (1, TypeName (OBJF), "folder") > 0 Then
MsgBox "Selected folder:" & Objf.title
Else
MsgBox "Canceled"
End If

Function Isvalue (obj)
' Check whether the value has been returned.
Dim tmp
On Error Resume Next
TMP = "" & obj
If Err <> 0 Then
Isvalue = False
Else
Isvalue = True
End If
On Error GoTo 0
End Function

' * * * end

' Save as Xxx.vbs, double-click to run



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.