Folder.MoveHere method

Moves an item or items to this folder.


  [ vOptions ]


vItem [in]

Type: Variant

The item or items to move. This can be a string that represents a file name, a FolderItem object, or a FolderItems object.

vOptions [in, optional]

Type: Variant

Options for the move operation. This value can be zero or a combination of the following values. These values are based upon flags defined for use with the fFlags member of the C++ SHFILEOPSTRUCT structure. These flags are not defined as such for Visual Basic, VBScript, or JScript, so you must define them yourself or use their numeric equivalents.


Do not display a progress dialog box.


Give the file being operated on a new name in a move, copy, or rename operation if a file with the target name already exists.


Respond with "Yes to All" for any dialog box that is displayed.


Preserve undo information, if possible.


Perform the operation on files only if a wildcard file name (*.*) is specified.


Display a progress dialog box but do not show the file names.


Do not confirm the creation of a new directory if the operation requires one to be created.


Do not display a user interface if an error occurs.


Version 4.71. Do not copy the security attributes of the file.


Only operate in the local directory. Do not operate recursively into subdirectories.


Version 5.0. Do not move connected files as a group. Only move the specified files.

Return value

This method does not return a value.



Not all methods are implemented for all folders. For example, the ParseName method is not implemented for the Control Panel folder (CSIDL_CONTROLS). If you attempt to call an unimplemented method, a 0x800A01BD (decimal 445) error is raised.



The following example uses MoveHere to move the file Temp.txt from the root directory of the C drive to the C:\Windows folder. Proper usage is shown for JScript, VBScript, and Visual Basic.


<script language="JScript">

    function fnFolderObjectMoveHereJ()
        var objShell  = new ActiveXObject("shell.application");
        var objFolder = new Object;
        objFolder = objShell.NameSpace("C:\\WINDOWS");
        if (objFolder != null)
            objFolder.MoveHere ("C:\\temp.txt", FOF_NOCONFIRMATION);


<script language="VBScript">
    private const FOF_NOCONFIRMATION = 16
    function fnFolderObjectMoveHereVB()
        dim objShell
        dim objFolder

        set objShell = CreateObject("shell.application")
        set objFolder = objShell.NameSpace("C:\WINDOWS")

        if (not objFolder is nothing) then
            objFolder.MoveHere "C:\temp.txt", FOF_NOCONFIRMATION
        end if

        set objFolder = nothing
        set objShell = nothing
    end function

Visual Basic:


Private Sub btnMoveHere_Click()
    Dim objShell  As Shell
    Dim objFolder As Folder

    Set objShell = New Shell
    Set objFolder = objShell.NameSpace("C:\WINDOWS")

    If (Not objFolder Is Nothing) Then
        objFolder.MoveHere "c:\temp.txt", FOF_NOCONFIRMATION
    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 2000 Server [desktop apps only]
Shell32.dll (version 4.71 or later)