The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

moveFirst Method (Enumerator) (JavaScript)

Resets the current item in the collection to the first item.

Caution note Caution

This object is supported in Internet Explorer only.

enumObj.moveFirst( )

The required enumObj reference is any Enumerator object.

If there are no items in the collection, the current item is set to undefined.

In following example, the moveFirst method is used to evaluate members of the Drives collection from the beginning of the list:

function ShowDrives()
    var s = "";
    var bytesPerGB = 1024 * 1024 * 1024;

    var fso = new ActiveXObject("Scripting.FileSystemObject");
    var e = new Enumerator(fso.Drives);

    while (e.atEnd() == false)
        var drv = e.item();

        s += drv.Path + " - ";

        if (drv.IsReady)
            var freeGB = drv.FreeSpace / bytesPerGB;
            var totalGB = drv.TotalSize / bytesPerGB;

            s += freeGB.toFixed(3) + " GB free of ";
            s += totalGB.toFixed(3) + " GB";
            s += "Not Ready";

        s += "<br />";


Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, and Internet Explorer 10 standards. Not supported in Windows 8.x Store apps. See Version Information.

Applies To: Enumerator Object (JavaScript)

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft