System.Shell.Folder.copyHere method

[ The Windows Gadget Platform/Sidebar is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. ]

Copies a System.Shell.Item to a folder.


  [ intOptions = 0 ]


oItem [in]

The System.Shell.Item to copy.

intOptions [in, optional]

Integer that specifies any combination of copy operation options.


These values are based on flags defined for use with the fFlags member of the C++ SHFILEOPSTRUCT structure. These flags are not defined for Microsoft Visual Basic, Visual Basic Scripting Edition (VBScript), or Microsoft JScript, so you must define the values or use their numeric equivalents.


Default. No options specified.


Do not display a progress dialog box.


Rename the target file if a file exists at the target location with the same name.


Click "Yes to All" in any dialog box displayed.


Preserve undo information, if possible.


Perform the operation 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.


Disable recursion.


Do not copy connected files as a group. Only copy the specified files.

Return value

This method does not return a value.


A Shell folder object must be obtained from a System.Shell.Item using the SHFolder property in order to perform this call.


The following example demonstrates how to copy an object to a system folder.

// Member variables.
var oShellFolderItem;
var oShellFolder;

// --------------------------------------------------------------------
// Display the folder picker dialog and get a Shell.Item object 
// from the selection. A Shell folder object is also obtained.
// --------------------------------------------------------------------
function ChooseAFolder()
    oShellFolderItem = System.Shell.chooseFolder("SDK Choose Folder Example", 0);
    if (oShellFolderItem)
        // Get a folder object from the System.Shell.Item.
        oShellFolder = oShellFolderItem.SHFolder;

// --------------------------------------------------------------------
// Display the names of objects dropped on the gadget.
// Objects are deleted, copied, or moved as required.
// --------------------------------------------------------------------
function GetItemFromDrop()
    var intIndex = 0;
    var oItem;
    while(oItem = System.Shell.itemFromFileDrop(event.dataTransfer, intIndex))
        // Delete object as required.
        if (deleteDrop.checked == true)
        // Copy object as required.
        if ((copyDrop.checked == true) && (oShellFolder!= null))
                oShellFolder.copyHere(oItem, 8);
            catch (e)
                // Error handling.
        // Move object as required.
        if ((moveDrop.checked == true) && (oShellFolder != null))
                oShellFolder.moveHere(oItem, 8);
            catch (e)
                // Error handling.


Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
End of client support
Windows 7
End of server support
Windows Server 2008
Sidebar.Exe (version 1.00 or later)