FolderItems2.InvokeVerbEx method

Executes a verb on a collection of FolderItem objects. This method is an extension of the InvokeVerb method, allowing additional control of the operation through a set of flags.


iRetVal = FolderItems2.InvokeVerbEx(
  [ vVerb ],
  [ vArgs ]


vVerb [in, optional]

Type: Variant

A Variant with the verb string that corresponds to the command to be executed. If no verb is specified, the default verb is executed.

vArgs [in, optional]

Type: Variant

A Variant that consists of a string with one or more arguments to the command specified by vVerb. The format of this string depends on the particular verb.


A verb is a string used to specify a particular action associated with an item or collection of items. Typically, calling a verb launches a related application. For example, calling the open verb on a .txt file normally opens the file with a text editor, usually Microsoft Notepad. For further discussion of verbs, see Launching Applications.


The following example uses InvokeVerbEx to invoke the default verb ("open") on My Computer. Proper usage is shown for JScript, VBScript, and Visual Basic.


<script language="JScript">
    function fnFolderItems2InvokeVerbExJ()
        var objShell  = new ActiveXObject("shell.application");
        var objFolder;
        var ssfDRIVES = 17;
        objFolder = objShell.NameSpace(ssfDRIVES);
        if (objFolder != null)
            var objFolderItems2;
            objFolderItems2 = objFolder.Items();
            if (objFolderItems2 != null)


<script language="VBScript">
    function fnFolderItems2InvokeVerbExVB()
        dim objShell
        set objShell = CreateObject("shell.application")
        if (not objShell is nothing) then
            dim objFolder
            dim ssfDRIVES
            ssfWINDOWS = 17
            set objFolder = objShell.NameSpace(ssfWINDOWS)
            if (not objFolder is nothing) then
                dim objFolderItems2
                set objFolderItems2 = objFolder.Items()
                if (not objFolderItems2 is nothing) then
                end if
                set objFolderItems2 = nothing
            end if
            set objFolder = nothing
        end if
        set objShell = nothing
    end function

Visual Basic:

Private Sub fnFolderItems2InvokeVerbExVB()
    Dim objShell      As Shell
    Dim objFolder     As Folder2
    Dim ssfDRIVES     As Long
    ssfDRIVES = 17
    Set objShell = New Shell
    Set objFolder = objShell.NameSpace(ssfDRIVES)
        If (Not objFolder Is Nothing) Then
            Dim objFolderItems2 As FolderItems
            Set objFolderItems2 = objFolder.Items
                If (Not objFolderItems2 Is Nothing) Then
                End If
            Set objFolderItems2 = Nothing
        End If
    Set objFolder = Nothing
    Set objShell = Nothing
End Sub


Requirement Value
Minimum supported client
Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Shell32.dll (version 5.0 or later)

See also